C语言中怎么判断输入日期格式是否正确,要求输入的格式为年-月-日...答:char str[100];memset(str,0,100);strcpy(str,"1995-12-06")int year,month,day;sscanf(str,"%d-%d-%d",&year,&month,&day);//自己调试下就好了
c语言:从键盘上输入一个日期,判断输入的日期是否正确答:判断年份大于0、月份大于0小于13、日期大于0小于等于月份对应的天数为正确输入,否则为错误输入。代码如下:include "stdio.h"int main(int argc,char *argv[]){ int y,m,d,md[12]={31,28,31,30,31,30,31,31,30,31,30,31};//md是每月天数数组 printf("Please enter the year, m...
C语言设计程序判断身份证号的合法性,并输出到指定日期的天数?_百度...答:={ {31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}};const int WF[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};const char PIN[11] = { '1', '0', 'X', '9'...