請問我程式哪裡錯了,只出現WA..
#include <iostream>
using namespace std;
int main()
{
int year;
cin >> year;
if (year%4 == 0 && year%400 == 0)
{
cout << "閏年" << endl;
}
else if (year%4 == 0 && year%100 != 0)
{
cout << "閏年" << endl;
}
else
{
cout << "平年" << endl;
}
return 0;
}
請問我程式哪裡錯了,只出現WA..
#include
using namespace std;
int main()
{
int year;
cin >> year;
if (year%400 == 0)
{
cout << "閏年" << endl;
}
else if (year%4 == 0 && year%100 != 0)
{
cout << "閏年" << endl;
}
else
{
cout << "平年" << endl;
}
return 0;
}
要改成這樣
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{int y;
while(cin>>y){
if(0==y%400){
cout<<"閏年"<<endl; }
else if(0==y%100){
cout<<"閏年"<<endl;}
else if(0==y%4){
cout<<"閏年"<<endl;}
else{cout<<"平年"<<endl;}}
return EXIT_SUCCESS;
}