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

前辈帮我看看我错在哪里?

Posted by y_zou at 2005-02-12 23:31:12 on Problem 1008
我调式了一晚上,我不知道自己还错在哪里?请前辈帮我指点一下,
谢谢了 

#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:
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