What's the trap of the problem?
It runs well on my computer , can anybody tell me the problem..
Thank you in advance.
another question is that the following codes don't concern with C++
but if I take away the first line and submit it for C,it will cause compile error. I am confused
[c]#include <iostream.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void format(int day, int month, int year, char t[][10])
{
int totaldays;
int trest;
int tyear,tmonth,tday;
totaldays = year*365+month*20+day+1;
trest = totaldays%260;
tyear = totaldays/260;
tmonth =(trest-1)%20;
tday = trest%13;
printf("%d %s %d\n",tday, t[tmonth], tyear);
}
int main()
{
char m[][10] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin"
, "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan",
"pax", "koyab", "cumhu","uayet"};
char t[][10] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi",
"manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix",
"mem", "cib", "caban", "eznab", "canac", "ahau"};
int number;
int i;
int j;
int day;
int month;
int year;
char cday[4];
char cmonth[8];
char cyear[5];
scanf("%d" ,&number);
printf("%d\n" , number);
for(i=0;i<number;i++)
{
scanf("%s",cday);
cday[strlen(cday)-1]='\0';
day=atoi(cday);
scanf("%s",cmonth);
for(j=0;j<20;j++)
{
if(strcmp(cmonth,m[j])==0)
break;
}
month = j;
scanf("%s", cyear);
year= atoi(cyear);
format(day, month, year,t);
}
return 0;
}[/c]