#include <stdio.h>
struct DATE
{ int year;
int month;
int day;
};
struct DATE *p;
int date_number(int p->year,int p->month,int p->day) // 这个地方有问题。。。怎么改?
{ int a[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}};
int months,flag,sum,total_days;
sum=0;
total_days=0;
if(p->year%400==0||p->year%4==0&&p->year%100!=0)
flag=1;
else
flag=0;
for(months=1;months<=p->month;months++)
sum+=a[flag][months-1];
total_days=sum+p->day;
return(total_days);
}
main()
{
int order;
printf("please input the date:\n");
sancf("%d%d%d",&p->year,&p->month,&p->day);
order=date_number(int,int,int);
printf("it is the %dth day",order);
getch();
}
[此贴子已经被作者于2005-10-10 17:35:39编辑过]