#10704: c++哪裡錯啊?


ning0777 (unknown)


#include <iostream>
using namespace std;

int main(){
int y;
while(cin>>y){
if(y%400==0){
cout<<"閏年"<<endl;
}
else if(y%400!=0&&y%100==0){
cout<<"平年"<<endl;
}
else if(y%100!=0&&y%4==0){
cout<<"閏年"<<endl;
}
else{
cout<<"平年"<<endl;
}

return 0;
}
}

 

ps.一直出現WA

#12034: Re:c++哪裡錯啊?


asd11020313 (unknown)


#include <iostream>

using namespace std;

 

int main()

{

int y;

while(cin>>y)

{

if(y%400==0)

{

cout<<"閏年"<<endl;

}

else if(y%400!=0&&y%100==0)

{

cout<<"平年"<<endl;

}

else if(y%100!=0&&y%4==0)

{

cout<<"閏年"<<endl;

}

else

{

cout<<"平年"<<endl;

}

}

return 0;

/*} <-往上移到 return 0; 上方 */

}