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 |
前辈帮我看看我错在哪里?我调式了一晚上,我不知道自己还错在哪里?请前辈帮我指点一下, 谢谢了 #include<iostream> #include<cctype> using namespace std; typedef struct Date { int _day; char _haab[9]; int _year; }Date; int main() { char *Haab[19] ={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}, *Tzolkin[20] ={ "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" }; int n,i,j,month; char c; cin>>n; Date *date = new Date[n]; for(i = 0; i<n;i++) { cin>>date[i]._day>>c>>date[i]._haab>>date[i]._year; for(j = 0; j<19; j++) if(strcmp(date[i]._haab,Haab[j])==0){ month = j; break; } int sum = date[i]._day + 20*month+date[i]._year*365; cout<<"sum ="<<sum<<endl; int T_year = (sum+1) / 260; int name = sum%20; strcpy(date[i]._haab , Tzolkin[name]); date[i]._day = sum % 13 +1; date[i]._year = T_year; } cout<<n<<endl; for(i = 0; i<n; i++) cout<<date[i]._day<<" "<<date[i]._haab<<" "<<date[i]._year<<endl; system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator