3个回答
展开全部
#include<iostream>
using namespace std;
int isLeap(int year)
{
if( year%400 == 0 || (year %4 == 0 && year %100 !=0))
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int year;
int month;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
cout<<"please input the year"<<endl;
cin>>year;
cout<<"please input the month"<<endl;
cin>>month;
if(isLeap(year))
{
a[1] = a[1] +1;
}
cout<<"days = "<<a[month-1]<<endl;
cin.get();
cin.get();
return 0;
}
using namespace std;
int isLeap(int year)
{
if( year%400 == 0 || (year %4 == 0 && year %100 !=0))
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int year;
int month;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
cout<<"please input the year"<<endl;
cin>>year;
cout<<"please input the month"<<endl;
cin>>month;
if(isLeap(year))
{
a[1] = a[1] +1;
}
cout<<"days = "<<a[month-1]<<endl;
cin.get();
cin.get();
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
void main()
{ int temp=0,month,year;
printf("Please input (year,month):");
scanf("%d,%d",&year,&month);
if((year%400==0)||(year%4==0&&year%100!=0))
temp=1;
{if(month==2)
{if(temp==
1)
printf("%dyear%dmonth have 29 days\n",year,month);
else printf("%dyear%dmonth have 28 days\n",year,month);
}
else
{ if(month<=7)
{if(month%2==1)
printf("%dyear%dmonth have 31 days\n",year,month);
else
printf("%dyear%dmonth have 30 days\n",year,month);}
else
{if(month%2==1)
printf("%dyear%dmonth have 30 days\n",year,month);
else
printf("%dyear%dmonth have 31 days\n",year,month);}
}
}
}
void main()
{ int temp=0,month,year;
printf("Please input (year,month):");
scanf("%d,%d",&year,&month);
if((year%400==0)||(year%4==0&&year%100!=0))
temp=1;
{if(month==2)
{if(temp==
1)
printf("%dyear%dmonth have 29 days\n",year,month);
else printf("%dyear%dmonth have 28 days\n",year,month);
}
else
{ if(month<=7)
{if(month%2==1)
printf("%dyear%dmonth have 31 days\n",year,month);
else
printf("%dyear%dmonth have 30 days\n",year,month);}
else
{if(month%2==1)
printf("%dyear%dmonth have 30 days\n",year,month);
else
printf("%dyear%dmonth have 31 days\n",year,month);}
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <iostream>
using namespace std;
int month[13] ={0,31,28,31,30,31,30,31,31,30,31,30,31};
int run(int year)
{
return (year%4==0 && year%100!=0) || year%400==0;
}
int main()
{
int y, m;
while(scanf("%d%d", &y, &m)==2)
{
month[2] = 28 + run(y);
printf("%d\n", month[m]);
}
}
using namespace std;
int month[13] ={0,31,28,31,30,31,30,31,31,30,31,30,31};
int run(int year)
{
return (year%4==0 && year%100!=0) || year%400==0;
}
int main()
{
int y, m;
while(scanf("%d%d", &y, &m)==2)
{
month[2] = 28 + run(y);
printf("%d\n", month[m]);
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询