C++编程:定义一个结构体变量(包括年月日),编写程序,要求输入年、月、日,程序能计算并输出该日在本年中
的有关信息介绍如下:
#include using namespace std;struct Date{ int year; int month; int day;};int main(){ Date date; int count_day,i; int month_day[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; bool leap; cout<<"输入年:"; cin>>date.year; cout<<"输入月"; cin>>date.month; cout<<"输入日"; cin>>date.day; count_day=date.day; if ((date.year%4==0 && date.year%100!=0) || (date.year%400==0)) { leap=true; } else { leap=false; month_day[2]=28; } for(i=0;i