返回列表 發帖
  1. #include<iostream>

  2. using namespace std ;

  3. int main()

  4. {

  5.    int age;

  6.    cout<<"請輸入你的年級:";

  7.    cin>>age;

  8.    if(age>0 && age<3)

  9.    {

  10.       cout<<"低年級"<<endl;

  11.     }else if(age>=3 && age<5)

  12.     {

  13.       cout<<"中年級"<<endl;

  14.       

  15.     }else if(age>=5 && age<7)

  16.     {

  17.       cout<<"高年級"<<endl;

  18.     }else if(age>=7 && age<10)

  19.     {

  20.           cout<<"國中生"<<endl;

  21.     }else if(age>=10 && age<13)

  22.     {

  23.           cout<<"高中生" <<endl;

  24.     }else if(age==0)

  25.     {

  26.           cout<<"幼稚園"<<endl;

  27.     }else if(age>=13 && age<17)

  28.     {

  29.           cout<<"大學生"<<endl;

  30.     }else

  31.     {

  32.      cout<<"亂打"<<endl;

  33.     }

  34.     system("pause");

  35.      return 0;

  36. }
複製代碼

TOP

返回列表