c语言读入一个年份和月份,打印出该月有多少天(考虑闰年)答:呃。。。太长了 试试我的吧:输入样例:年份 月份(2012 2)include<stdio.h>int month[2][12]={31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31};/*把月份的天数储存下来*/int run(int year){//判断闰年的函数,1代表闰年 if(year%4==0 && ...
c语言;输入一个年份,输出该年各月份天数以及总天数。答:include <stdio.h>main(){int i,year,month[12] ={31,28,31,30,31,30,31,31,30,31,30,31};scanf("%d",&year);if((year%4==0)&&(year%100!=0)||(year%400==0))month[1]++;year=0;for (i=0;i<12;i++)printf("month[%d]:day[%d]\n",i+1,month[i]),year+=...
C语言编程 编程序实现如下功能:输入任意一个年份和月份,求出从公元1...答:include<stdio.h>int Month[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31};int print_month[7][8];bool leap_year(int year){ return year%4==0&&year%100!=0||year%400==0;}int get_days(int year,int month,int day){//返回从公元1年1月1日到该日期的天数 int...
给出年份和天数,求出相应的月、日答:楼上的写错了,怎么不改了呢?我写了个:include<stdio.h> void main(){ int day_s[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};int days,year,month,day,i;printf("请输入年份和天数:");scanf("%d%d",&year,&days);if(year%4==0 && year%100!=0 ||year%400==0){ ...
c语言设计万年历 输入任意年份,输出该年12个月份 输入任意年份月份...答:一年12个月是固定的,我就不写单独输入年份打印月份了。你想就把我月份数组打印一遍好了。include<stdio.h>#include#include<malloc.h>enum MONTH{January=1,February,March,April,May,June,July,August,September,October,November,December};struct tm * getDate(int year,int mon);void printTime(...
c语言输入年份就能算出距离今年有多少天的代码怎么写答://给出一个时间,判断这一天是这一年的第几天 include<stdio.h> int main(){ int y,m,n,day,i;int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};printf("请输入年份:");scanf("%d",&y);printf("请输入月份:");scanf("%d",&m);printf("请输入日期:");scanf("%d...