#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int year; //定义年、月、日
int month;
int day;
int sum; //定义总共天数
cout << "请输入年、月、日" << endl;
cin >> year;
cin >> month;
cin >> day;
switch(month)
{
case 1:
sum = day; break;
case 2:
sum = day + 31; break;
case 3:
sum = day + 59; break;
case 4:
sum = day + 90; break;
case 5:
sum = day + 120; break;
case 6:
sum = day + 151; break;
case 7:
sum = day + 181; break;
case 8:
sum = day + 212; break;
case 9:
sum = day + 243; break;
case 10:
sum = day + 273; break;
case 11:
sum = day + 304; break;
case 12:
sum = day +
利用C++,设置输入某年某月某日,判断这一天是这一年的第几天。
最新推荐文章于 2024-04-26 20:06:59 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)