#11427: wrong again?


warren (warren(爽啦))


#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
 
 int x;
 
 cin >>x;
 
   if((x>=0)&&(x<=10))
     cout << x*6 <<endl;
   if((x>=11)&&(x<=20))
     cout << 60+(x-10)*2<<endl ;
   if((x>=21)&&(x<=40))
     cout << 80+(x-20)<<endl ;
   if(x>40)
     cout << 100<<endl ;
 
 
 
 
 
 return 0;
}

 

#11444: Re:wrong again?


bear890707 (Tim Hsiung)


#include
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
 
 int x;
 
 cin >>x;
 
   if((x>=0)&&(x<=10))
     cout << x*6 <<endl;
   if((x>=11)&&(x<=20))
     cout << 60+(x-10)*2<   if((x>=21)&&(x<=40))
     cout << 80+(x-20)<   if(x>40)
     cout << 100< 
 
 
 
 
 return 0;
}

 

用迴圈括起來阿