大学职业搜题刷题APP
下载APP
首页
课程
题库模板
Word题库模板
Excel题库模板
PDF题库模板
医考护考模板
答案在末尾模板
答案分章节末尾模板
题库创建教程
创建题库
登录
logo - 刷刷题
创建自己的小题库
搜索
【简答题】

已知C源程序如下:
/*Input today’s date,output tomorrow’s date*/
/*version 2*/
#include<stdio.h>
struct ydate
{ int day;int month;int year;};
int leap(struct ydate d)
{ if((d.year%4==0&&d.year%100!=0)||(d.year%400==0))
    return 1;
   else
    return 0;
}
int numdays(struct ydate d)
{ int day;
   static int daytab[]=
    {31,28,31,30,31,30,31,31,30,31,30,31);
   if(leap(d)&&d.month==2)
    day=29;
   else
    day=daytab[d.month-1];
   return day;
}
int main(void)
{ struct ydate today,tomorrow;
   printf("format of date is:year,month,day 输入的年、月、日之间应用逗号隔开\n");
   printf("today is:");
   scanf("%d,%d,%d",&today.year,&today.month,&today.day);
   while(0>=today.year
|| today.year>65535 || 0>=today.month || today.month>12) ||
0>=today.day || today.day>numdays(today))
   {  printf("input date error!reenter the day!\n");
printf("today is:");
scanf("%d,%d,%d",&today.year,&today.month,&today.day);
}
if(today.day!=numdays(today))
{ tomorrow.year=today.year;
tomorrow.month=today.month;
tomorrow.day=today.day+1;
}
else if(today.month==12)
{ tomorrow.year=today.year+1;
tomorrow.month=1;
tomorrow.day=1;
}
else
{ tomorrow.year=today.year;
tomorrow.month=today.month+1;
tomorrow.day=1;
}
printf("tomorrow is:%d,%d,%d\n\",
tomorrow.year,tomorrow.month,tomorrow.day);
}
画出程序中所有函数的控制流程图;

手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
收藏 - 刷刷题收藏
举报
参考答案:
刷刷题-刷题-导入试题 - 刷刷题
参考解析:
AI解析
重新生成
题目纠错 0
发布
刷刷题-刷题-导入试题 - 刷刷题刷刷题-刷题-导入试题 - 刷刷题刷刷题-刷题-导入试题 - 刷刷题
刷刷题-刷题-导入试题 - 刷刷题
刷刷题-刷题-导入试题 - 刷刷题
刷刷题-单词鸭