main(){int y,m,s;while(1){ scanf("%d/%d/%d",&y,&m,&s);printf("%d--%d--%d\n\n",y,m,s);} }
cCopy code#include <stdio.h>int main(){ int month1, day1, year1; int month2, day2, year2;// 输入第一个日期 printf("Enter date in mm/dd/yyyy format: "); scanf("%d/%d/%d", &month1, &day1, &year1);// 输入第二个日期 printf("Enter another date in mm...
{ int year,year1,month,month1,day,day1,age;printf("请输入您的生日:");scanf("%d %d %d",&year,&month,&day);printf("请输入当前日期:");scanf("%d %d %d",&year1,&month1,&day1);if(year1==year)age=0;else {age=year1-year;if(month1<month||(month1==month&&d...
//输入的时候 按 2004-10-31这样格式输入
date1: 格式YYYYMMDD, 输入参数 date2: 格式YYYYMMDD, 输入参数/输出参数 num: 数字, 输入参数/输出参数 可正可负 RETURN VALUE:0: 计算成功 非0: 计算失败 NOTICE: date2作为出口参数时不能是无结束符的字符串的中间字段 因为赋值时将会在date2的后面增加字符串结束符 ---*/ int CalcDate(int...
printf("今天的日期:%d年%d月%d日\n",local->tm_year+1900,local->tm_mon+1,local->tm_mday);printf("输入生日:");scanf("%d%d%d",&year,&month,&day);for(i=year+1;i<local->tm_year+1900;i++){ if(i%400==0||i%100!=0&&i%4==0)sum+=366;else sum+=365;} if((...
char str[100];memset(str,0,100);strcpy(str,"1995-12-06")int year,month,day;sscanf(str,"%d-%d-%d",&year,&month,&day);//自己调试下就好了