日期结构体
来源:互联网 发布:淘宝宝贝描述图片素材 编辑:程序博客网 时间:2024/06/09 19:57
/*
*Copyright (c) 2013 ,烟台大学计算机学院
*All rights reserved.
*作者:张凤宁
*完成日期:2014年3月4
*版本号:v1.0
*问题描述:
*样例输入:4 -5
*样例输出:
*问题分析:用简单的方法,学会活学活用
*/
#include <iostream>
using namespace std;
struct Date
{
int year;
int month;
int day;
};
int main()
{
Date date;
cout<<"input year,month,day:";
cin>>date.year>>date.month>>date.day;
int days=0;
int day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
for(int i=0;i<date.month;i++)
{
days+=day[i];
days+=date.day;
}
if((date.year%4==0&&date.year%100!=0)||(date.year%400==0))
{
days+=1;
}
cout<<date.month<<"月"<<date.day<<"日是"<<date.year<<"年的第"<<days<<"天."<<endl;
return 0;
}
运行结果:
心得体会:时间长了差不多忘了,该多看看书了。不要失望,加油
0 0
- 日期结构体
- 日期结构体
- 日期结构体
- 结构体日期
- 日期结构体
- 日期结构体
- 日期结构体
- 日期结构体
- 日期结构体
- 结构体日期
- 日期结构体
- 日期结构体
- 日期结构体
- 日期结构体
- 日期结构体
- 结构体日期计算
- 【结构体】项目三。日期结构
- 项目2:日期结构体
- Unity3D研究院之在项目中使用Unity4新Mecanim动画(五十三)
- SharedPrefereces的工具类
- windows installer目录瘦身
- IEEE 754浮点数
- 程序员工作态度
- 日期结构体
- MacBook Pro OS X Mavericks chrome 33 google 帐户同步 无限次漰溃 解决方案
- Unable to establish route
- 第十四周 呜呜呜
- ajax实现表单用户名校验
- during its initialization is never read
- iOS学习笔记——视图上移与键盘弹回
- error:The calling thread cannot access this object because a different thread owns it解决方法
- gdb 调试