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...
1: 获取date1当月的第一天 赋值到date2 其他参数无效 2: 获取date1当月的最后一天 赋值到date2 其他参数无效 3: 获取date1的num天之后的日期 赋值到date2, 当num为负值时获取date1之前的日期 4: 获取date1的num月之后的日期 赋值到date2, 当num为负值时获取date1之前的日期 若大于月末则赋值...
//输入的时候 按 2004-10-31这样格式输入
{ int a,b,c,i,j,k;printf("please input you friend`s birthday:");scanf("%d %d %d",&a,&b,&c);printf("input date:");scanf("%d %d %d",&i,&j,&k);if(k-c<0){printf("%d",c+30-k);j=j-1;} else()printf("%d",c-k);if(j-b<0){ printf("%d",j+12-b)...
scanf(“%d.%d.%d”,&year,&month,&day);scanf(“%d-%d-%d”,&year,&month,&day);
,&year,&month,&day); printf("请输入当前日期:&qu... lt;day)) age=age-1;} printf("您的年龄是:%d",age); } 大概就是这个... 怎样用c语言编写以年月日的格式输入一个人的生日和当前日期,来计算这个人的年龄 #include"stdio.h"main(){int a,b,c,i,j,k;printf("please input...
char str[100];memset(str,0,100);strcpy(str,"1995-12-06")int year,month,day;sscanf(str,"%d-%d-%d",&year,&month,&day);//自己调试下就好了
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((...