关于C语言编写一万年历的问题,只能拿出50财富聊表谢意了#include#includeint main(void){intyear,month,day;intdays=0,i,j,n,m,k,o;intm1[]={31,28,31,30,31,30,31,31,30,31,30,31};intm2[]={31,29,31,30,31,30,31,31,30,31,30,31};time_t toda
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 09:01:42
关于C语言编写一万年历的问题,只能拿出50财富聊表谢意了#include#includeint main(void){intyear,month,day;intdays=0,i,j,n,m,k,o;intm1[]={31,28,31,30,31,30,31,31,30,31,30,31};intm2[]={31,29,31,30,31,30,31,31,30,31,30,31};time_t toda
关于C语言编写一万年历的问题,只能拿出50财富聊表谢意了
#include
#include
int main(void)
{intyear,month,day;
intdays=0,i,j,n,m,k,o;
intm1[]={31,28,31,30,31,30,31,31,30,31,30,31};
intm2[]={31,29,31,30,31,30,31,31,30,31,30,31};
time_t today;
struct tm *p;
time(&today);
p=localtime(&today); //转换成本地时间的日期
year=p->tm_year+1900;
month=p->tm_mon+1;
day=p->tm_mday;
printf(" %4d-%02d\n",year,month); //打印出年月
if(year>=0) //由于已知公元元年1月1日为星期一,所以以改日为基准计算
for(i=0;i
关于C语言编写一万年历的问题,只能拿出50财富聊表谢意了#include#includeint main(void){intyear,month,day;intdays=0,i,j,n,m,k,o;intm1[]={31,28,31,30,31,30,31,31,30,31,30,31};intm2[]={31,29,31,30,31,30,31,31,30,31,30,31};time_t toda
m=m2[month]; 有问题的,要-1,m=m2[month-1];
下面这句也一样m=m1[month-1];