输入一个年份xxxx(四位数字),按顺序输出该年之后接下来的8个闰年,输出格式为:
The eight leap years following xxxx are:year1,year2,……,year8.
注: xxxx显示为所输入的年份,year1~ year8分别显示为8个闰年年份(四位数字)。#include<iostream>
using namespace std;
int main(){
int i,n;
int count=0;
cin >> n;
for(i=n+1;;i++){
if(i%4==0 && i%100!=0 || i%400==0){
count++;
cout <<i;
if(count<=7)cout << ",";
}
if(count==8)break;
}
return 0;
}
急急急