#include<iostream>
using namespace std;
int main(){
int a,i;
cin>>a;
int k[a];
for(i=0;i<a;i++){
int y=k[i];
if((y%4==0&&y%100>0)||(y%400==0))
cout<<"Case "<<i+1<<": a leap year"<<endl;
else
cout<<"Case "<<i+1<<": a normal year"<<endl;
}
system("pause");
return 0;
}
我是初學者~很多東西還不熟悉
麻煩好心人指點~謝謝ˇ
#include<iostream>
using namespace std;
int main(){
int a,i;
cin>>a;
int k[a];
for(i=0;i<a;i++){
cin>>k[i]; /*要讀取數再去判斷 輸入的值並不會存在宣告的陣列中 故要讀取*/
int y=k[i];
if((y%4==0&&y%100>0)||(y%400==0))
cout<<"Case "<<i+1<<": a leap year"<<endl;
else
cout<<"Case "<<i+1<<": a normal year"<<endl;
}
system("pause"); /* 這個可以不用 有return 0; 就夠了 */
return 0;
}