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


hellowilly66@gmail.com (Oliver)

School : 國立嘉義高級中學
ID : 154115
IP address : [118.171.230.80]
Last Login :
2021-07-20 11:20:44
a004. 文文的求婚 | From: [220.143.169.103] | Post Date : 2021-05-13 21:41

#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 (吳亮佑)

School : 國立嘉義高級中學
ID : 145844
IP address : [36.232.101.212]
Last Login :
2021-04-26 20:52:21
a004. 文文的求婚 | From: [36.232.101.212] | Post Date : 2021-06-15 14:14

#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++到放棄)

School : 國立臺北科技大學
ID : 158527
IP address : [36.224.203.187]
Last Login :
2021-07-31 11:09:47
a004. 文文的求婚 | From: [36.224.208.226] | Post Date : 2021-07-14 11:20

#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;

 

 
ZeroJudge Forum