Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求助在VC++上运行完全正确,为什么总是说compile error啊?

Posted by segeon at 2010-03-04 13:55:50 on Problem 1008
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define NUM 1000

char dayName[21][10]={" ","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk", "ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};

struct HaabDate{
  int day;
  char month[7];
  int year;
};

int countDay(HaabDate d){
  int month;
  if(strcmp(d.month,"pop")==0) month=0;
  else if(strcmp(d.month,"no")==0) month=1;
  else if(strcmp(d.month,"zip")==0) month=2;
  else if(strcmp(d.month,"zotz")==0) month=3;
  else if(strcmp(d.month,"tzec")==0) month=4;
  else if(strcmp(d.month,"xul")==0) month=5;
  else if(strcmp(d.month,"yoxkin")==0) month=6;
  else if(strcmp(d.month,"mol")==0) month=7;
  else if(strcmp(d.month,"chen")==0) month=8;
  else if(strcmp(d.month,"yax")==0) month=9;
  else if(strcmp(d.month,"zac")==0) month=10;
  else if(strcmp(d.month,"ceh")==0) month=11;
  else if(strcmp(d.month,"mac")==0) month=12;
  else if(strcmp(d.month,"kankin")==0) month=13;
  else if(strcmp(d.month,"muan")==0) month=14;
  else if(strcmp(d.month,"pax")==0) month=15;
  else if(strcmp(d.month,"koyab")==0) month=16;
  else if(strcmp(d.month,"cumhu")==0) month=17;
  else month=18;
  return (d.day+1)+(month*20)+(d.year*365);
}
int main(){
  int i,n,nameIndex;
  HaabDate date[NUM];
  int dayNum,year,day,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d. %s %d",&date[i].day,&date[i].month,&date[i].year);
  }
  printf("%d\n",n);
  for(i=0;i<n;i++){
    dayNum=countDay(date[i]);
    year=(dayNum-1)/260;
    temp=dayNum%260;
    day=temp%13;
    if(day==0) day=13;
    nameIndex=temp%20;
    if(nameIndex==0) nameIndex=20;
    printf("%d %s %d\n",day,dayName[nameIndex],year); 
  }
}
-------------------------------------
Compile Error

Main.c
Main.c(14) : error C2146: syntax error : missing ')' before identifier 'd'
Main.c(14) : error C2061: syntax error : identifier 'd'
Main.c(14) : error C2059: syntax error : ';'
Main.c(14) : error C2059: syntax error : ')'
Main.c(14) : error C2449: found '{' at file scope (missing function header?)
Main.c(36) : error C2059: syntax error : '}'

翻来覆去看很多遍,还是没发现问题。。。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator