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 |
为什么我这个1008程序总是Runtim error?急求解#include<stdio.h> #include<string.h> struct Habb{ int day; long int year; char month[10]; }input[100]; struct Tkolzin{ int number; char name[10]; long int year; }output[100]; int total; //设置转换函数 void zhuan(int i,int Hm[],char Hmn[][10],char Tn[][10]) { int yt;int j; yt=input[i].year*105; output[i].year=input[i].year+yt/260; total=yt%260; for(j=0;j<19;j++) { if(strcmp(input[i].month,Hmn[j])==0)break; total=total+Hm[j]; } total=total+input[i].day+1; output[i].year=output[i].year+total/260; total=total%260; output[i].number=total%13; if(output[i].number==0)output[i].number=13; yt=total%20; if(yt==0)yt=20; strcpy(output[i].name,Tn[yt-1]); } int main() { int i,n; //设置Habb月份天数和名称 int Hm[19]; for(i=0;i<18;i++) { Hm[i]=20; } Hm[18]=5; char Hmn[][10]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"}; //设置Tkolzin名称 char Tn[][10]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk", "ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; //读入数据 scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d. %s %d",&input[i].day,input[i].month,&input[i].year); } //转换 for(i=0;i<n;i++) { zhuan(i,Hm,Hmn,Tn); } //输出 printf("%d\n",n); for(i=0;i<n;i++) { printf("%d %s %d\n",output[i].number,output[i].name,output[i].year); } return(0); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator