/*
* 程序的版权和版本声明部分
* Copyright (c)2013, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称:score.cpp
* 作 者:
* 完成日期: 年 月 日
* 版本号: v1.0
*/
#include <iostream>
using namespace std;
struct Date
{
int year;
int month;
int day;
int hour;
int minute;
int second;
};
int main()
{
int days=0,second=0;
long seconds;
int d[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int i;
Date date;
cout<<"请输入时间(年、月、日、时、分、秒):"<<endl;
cin>>date.year>>date.month>>date.day>>date.hour>>date.minute>>date.second;
for(i=1;i<date.month;i++)
days+=d[i];
days+=date.day;
if ((date.year %4== 0 && date.year % 100 != 0 ||date.year % 400 == 0) && date.month >=3)
days+=1;
cout<<date.year<<"年"<<date.month<<"月"<<date.day<<"日"<<"是第"<<days<<"天"<<endl;
second+=(date.minute*3600)+(date.minute*60);
cout<<"这一天的第"<<second<<"秒"<<endl;
seconds=((days-1)*24*3600)+second;
cout<<"这一年中的第"<<seconds<<"秒"<<endl;
return 0;
}
玩日期,,,,
最新推荐文章于 2021-10-13 10:31:08 发布