Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
要死人啦!为什么Rumtime ERROR!请高手指教,给个令我程序出错的数据也行啊#include <stdlib.h> #include <stdio.h> #include <string.h> char *MONTH_H[19] = {"pop","no","zip","zotz","tzec","tzec","xul","yoxkin","mol","chen","zac","ceh","mac","kankin","muan","pax","koyab", "koyab","uayet"}; char *DAY_T[20] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik","lamat","muluk", "ok", "chuen", "eb", "ben","ix","mem", "cib", "caban", "eznab", "canac", "ahau"}; void switchH(char nameMonthH[10],int *numMonthH); void switchT(int numDayT,char nameDayT[10]); main() { char nameMonthH[10],nameDayT[10]; int numMonthH,numDayT,dayH,yearH,preiodT,yearT,day,n; scanf("%d",&n); while(n--) { scanf("%d. %s %d",&dayH,nameMonthH,&yearH); switchH(nameMonthH,&numMonthH); day = yearH * 365 + (numMonthH - 1) * 20 + dayH + 1; yearT = day / 260; if(!(day % 260)) yearT--; preiodT = day % 13; if(!preiodT) preiodT = 13; numDayT = day % 20; if(!numDayT) numDayT = 20; switchT(numDayT,nameDayT); printf("%d %s %d\n",preiodT,nameDayT,yearT); } } void switchH(char nameMonthH[10],int *numMonthH) { int i = 0; while(strcmp(nameMonthH,MONTH_H[i++])) if(i >= 20) printf("ERROR"); *numMonthH = i; return ; } void switchT(int numDayT,char nameDayT[10]) { strcpy(nameDayT,DAY_T[numDayT - 1]); return; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator