#include "Stdio.h"
struct date
{ int month;
int day;
int year;
};
/*是否为润年*/
int ruinian(struct date *d)
{ if ((*d.year%4==0&&*d.year%100!=0)||*d.year%400==0)
return 1;
else -1;
}
/*返回月的最后一天*/
int chazhao(struct date *d)
{int days[]={31,28,31,30,31,30,31,31,30,31,30,31};
if (ruinian(*d)==1&&*d.month==2)
return 29;
else
return days[*d.month-1];
}
/*查找下一天*/
void update(struct date *today)
{ if (today->day!=chazhao(*today))
{today->day=today->+1;
today->month=today->month;
today->year=today->year;
}
else if (today->month==12)
{ today->day=1;
today->mont=1;
today->year=today->year+1;
}
else
{today->day=1;
today->month=today->month+1;
today->year=today->year;
}
}
int main(void)
{int ruinian(struct date *d);
int chazhao(struct date *d);
void update(struct date *today);
struct date today;
struct date *next=&today;
printf ("input today's date : mm/dd/yy\n");
scanf ("%i/%i/%i",today.month,today.day,today.year):
update(next);
printf ("%i/%i/%i",today.mont,today.day,today.year);
getch();
return 0;
}
这是关于以前输出下一天日期的程序。以前没有学过指针。所以也能写出来。现在讲到指针了,并且要用指针来改写这个程序。可是我怎么都搞不好。一开始就出错。。有没有哪位朋友帮帮偶呀。。我跪求。。。或者有没有哪位帮帮我在这个程序上修改一下。。。大家帮帮我呀5555555555555555
求求大家帮帮我呀!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[此贴子已经被作者于2007-7-26 22:20:27编辑过]