我的成长

在这里,希望可以与大家一起探讨编程哦。虽然我还是属于菜鸟级别的。

17闰年

题目编号 17
时间限制 1000 毫秒
内存限制 32768 K字节

问题描述

输入一个年份,判断是否闰年 

输入

输入包含多行,每行一个数字,表示年份

输出

输出包含多行,每行对应于输入,是闰年输出LEAP,否则输出NONLEAP

输入样例

2000
2001
2002
1900

输出样例

LEAP
NONLEAP
NONLEAP
NONLEAP
#include <cstdlib>
#include 
<iostream>

using namespace std;

int main(int argc, char *argv[])
{
    
int year;
    
while(cin >> year){
    
if((year%4 ==0&&year % 100 != 0)|| (year % 400 == 0))
          cout 
<< "LEAP" <<endl;
    
else
          cout 
<< "NONLEAP" <<endl;
               }
    system(
"PAUSE");
    
return EXIT_SUCCESS;
}

posted on 2006-10-28 16:54 林慧 阅读(100) 评论(0)  编辑 收藏 引用 所属分类: C++

只有注册用户登录后才能发表评论。