《C语言中求输入日期得到前一天日期的代码.docx》由会员分享,可在线阅读,更多相关《C语言中求输入日期得到前一天日期的代码.docx(3页珍藏版)》请在第壹文秘上搜索。
C语言中求输入日期得到前一天日期的代码#includeintmain()(intyear,month,day,leap;scanf(,z%d%d%d,z,&year,&month,&day);if(month=3)(if(year%400=0)Ieap=I;elseif(year%100-0)Ieap=O;elseif(year%4=0)Ieap=I;elseleap=0;if(Ieap=I)(if(day=l)day=29;month=2;elseday=day-l;if(Ieap=O)if(day=l)day=28;month=2;elseday=day-l;)elseif(month=1)(if(day=l)day=31;month=12;year=year-l;elseday=day-l;)elseif(month=4month=6Imonth=9month=ll)(if(day=l)day=31;month=month-l;elseday=day-l;else(if(day=l)day=30;month=month-l;)elseday=day-l;printf(z,%d%d%d”,year,month,day);return0;