#9559: 为什么这个程序不行?


yangty (yty)


#include<iostream.h>
int main()
{
int a;
char t;
cin >> a;
  if (a % 400 == 0) t='閏年';
    else
      if (a % 4 == 0 && a % 100 != 0) t='閏年';
 else
   t='平年';
cout << t;
}
#9565: Re:为什么这个程序不行?


28984048 (chi)


#include <iostream>

int pd (int in0){
    
    if (in0 %400 ==0 )
       return 1 ;
    else if (in0 %100 ==0 )
         return 0 ;
    else if (in0 %4 ==0 )
         return 1 ;
    else 
         return 0 ;
}

using namespace std;

int main()
{
    int in0, out;
    
    while (cin >>in0 ){
          
          cout <<(pd(in0)==1 ?"閏年" :"平年" ) <<endl ;
    }

}



#9566: Re:为什么这个程序不行?


tonyhsueh2002a (TAT(安安非他命))


#include <iostream>

int pd (int in0){
    
    if (in0 %400 ==0 )
       return 1 ;
    else if (in0 %100 ==0 )
         return 0 ;
    else if (in0 %4 ==0 )
         return 1 ;
    else 
         return 0 ;
}

using namespace std;

int main()
{
    int in0, out;
    
    while (cin >>in0 ){
          
          cout <<(pd(in0)==1 ?"閏年" :"平年" ) <<endl ;
    }

}