第1个回答 2019-12-27
#include<stdio.h>typedef struct {int y,m,d;}Date;int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};int checkDate(Date date){mon[2]=28+(date.y%4==0&&date.y%100||date.y%400==0); return date.y>0&&date.m>0&&date.d>0&&date.m<13&&date.d<=mon[date.m];}int main(){ Date date; scanf("%d%*c%d%*c%d",&date.y,&date.m,&date.d); printf("%s",(checkDate(date)?"OK":"Error")); return 0;}本回答被网友采纳