判断闰年
2015-09-16 20:42
316 查看
如果一年能被4整除且不能被100整除,或者改年能被400整除,则是闰年:
<span style="font-size:18px;">#include<iostream> #include<stdio.h> #include<string> using namespace std; int main() { int year; cout << "输入年份" << endl; cin >> year; cout << "------------------" << endl; cout << "| |" << endl; if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) cout << "闰年" << year << endl; else cout << "不是闰年" << endl; system("pause"); return 0; }</span>
相关文章推荐
- Android之自定义View以及画一个时钟
- 初识Linux
- 四、集合与泛型、委托与事件-----《大话设计模式》
- 决策树代码
- Linux内核学习(二)---Linux中的进程、线程和轻量级进程
- HDU - 2444 The Accomodation of Students(二分图判断+最大匹配)
- "Class not found: javac1.8"问题总结
- hdu 1060 Leftmost Digit
- 基因检测如何让癌症变的可预防?
- libsvm-2.84在MATLAB中使用遇到的刻骨铭心的error
- 杭电acm--2033
- 线程安全的实现延迟初始化的方案
- 【矩阵快速幂】ZOJ 2974 Just Pour the Water
- java学习之Set集合、HashSet
- MySQL(11):存储引擎
- HDU5446
- 堆排序
- SQL查询结果把两个字段拼接到一起
- java map的使用
- 3W咖啡商业计划书模板