第1个回答 推荐于2016-10-26
/*输入月份和年份 然后 输出月份的天数。直到输入 0 0 时, 输出 现在时间的 月份和年份 和天数。*/
#include <stdio.h>
#include <iostream>
void main()
{
printf("please input year");
int y, m;
scanf("%d",&y);
printf("please input month");
scanf("%d",&m);
if (y%4==0)
{
if (m==1||m==3||m==5||m==7||m==8||m==10||m==12)
{
printf("this month have 31 days!!");
}
else if (m==2)
{
printf("this month have 29 days!!");
}
else
{
printf("this month have 30 days!!");
}
if (y % 4 != 0)
{
if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
{
printf("this month have 31 days!!");
}
else if (m == 2)
{
printf("this month have 28 days!!");
}
else
{
printf("this month have 30 days!!");
}
}
if (y==0&&m==0)
{
system("time");
}
}本回答被提问者采纳