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

为什么runtime error

Posted by xuezhulin at 2007-12-30 15:00:21 on Problem 1008
我在vc++6.0上运行好好的程序,怎么提交后总runtime error 呢?
哪位仁兄帮我看一下代码,看问题出在哪里了?谢谢了!
//test.cpp

#include<stdio.h>
#include<string.h>

int HabbTo(int d,int m,int y);
void ToTzolkin(int ds);

int main()
{
	char *mon[19]={"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", 
		"chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
	int N,d,m,y,days,i,j;
	char s[20];
	scanf("%d",&N);
	printf("%d\n",N);
	for(j=0;j<N;j++)
	{
	scanf("%d%*2s%s%d",&d,s,&y);
	for(i=0;i<19;i++)
		if(strcmp(s,mon[i])==0)
		{
			m=i;
			break;
		}
	days=HabbTo(d,m,y);
    ToTzolkin(days);
	}
	return 0;
}

int HabbTo(int d,int m,int y)
{ 
	int days=y*365+m*20+d+1;
	return days;
}

void ToTzolkin(int ds)
{
	char *month[20]={"imix", "ik", "akbal", "kan", "chicchan", "cimi", 
		"manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", 
		"mem", "cib", "caban", "eznab", "canac", "ahau"};
	int d1,d2,y;
	y=ds/260;
	ds=ds%260;
	d1=ds%13;
	d1=(d1==0)?13:d1;
	d2=ds%20-1;
	printf("%d %s %d\n",d1,month[d2],y);
}



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