ZKX's LAB

【坐等】C语言编程题:输入某年某月,求该月天数。 编程从键盘输入某年某月

2021-04-28知识8

用C语言编程:输入某年某月某日,判断这一天是这一年的第几个星期中的星期几 include void main(){ int year,month,day;int tempmonth,yearday;int week,weekday;unsigned int sum=0;int tag=0;printf(\"输入年、月、日:\\n\");scanf(\"%d%d%d\",&year,&。

C语言程序设计:输入某年某月输出某月有多少天? #includevoid main(){int year,month;int month_day(int year,int month);printf(\"输入年份:\");scanf(\"%d\",&year);printf(\"输入月份:\");scanf(\"%d\",&month);printf(\"%d年%d月有%d天\",year,month,month_day(year,month));}int month_day(int year,int month){int day;switch(month){int day;case 1:case 3:case 5:case 7:case 8:case10:case 12:day=31;break;case 2:if(year%100。0&year%4=0)day=29;elseday=28;break;case 4:case 6:case 9:case 11:day=30;break;default:printf(\"输入月份不存在\");}return day;}

【坐等】C语言编程题:输入某年某月,求该月天数。 |#includevoid main(){int Year,Month,Day;cout(年月以空格分隔):;cin>;>;Year>;>;Month;while(Month|2113 Month>;12){cout输入5261时间有误,请重新输4102入:;cin>;>;Year>;>;Month;}switch(Month){case 4:case 6:case 8:case 9:case 11:Day=30;break;case 2:if(Year%400=0|Year%4=0&nYear%100。0)Day=29;elseDay=28;break;default:Day=31;}cout该月天数1653为:\"天;}

#编程从键盘输入某年某月

随机阅读

qrcode
访问手机版