#25332: (c++)這樣錯在哪?


hellowilly66@gmail.com (Oliver)


#include <iostream>

using namespace std;

int main()

{

int year;

while(cin>>year)

{

if(year %400 == 0)

{cout<<"閏年\n";}

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

{cout<<"閏年\n";}

else {cout<<"平年\n";}

return 0;

}

}

#25709: Re:(c++)這樣錯在哪?


s910251@student.cysh.cy.edu.tw (吳亮佑)


#include<iostream>

using namespace std;

int main(){

int a;

while(cin>>a){

if(a%4==0 && a%100!=0 ||a%400==0){

cout<<"閏年"<<endl;

}else{

cout<<"平年"<<endl;

      }

   }

}



#26047: Re:(c++)這樣錯在哪?


NTUT_vocation_club (從零學C++到放棄)


#include

using namespace std;

int main(){

int a;

while(cin>>a){

if(a%4==0 && a%100!=0 ||a%400==0){

cout<<"閏年"<<endl;

}else{

cout<<"平年"<<endl;

      }

   }

}



少了return 0;