返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int math=0;
  7.     int ww=0;
  8.     cout<<"月份:"<<endl;
  9.     cin>>math;
  10.     cout<<"用電量";
  11.     cin>>ww;
  12.     if(6<math||9<math)
  13.     {
  14.     else if(ww<120)
  15.     {
  16.     cout<<"2.1元"<<endl;
  17.     }
  18.      else if(121<=ww||ww<=330)
  19.     {
  20.     cout<<"2.68元"<<endl;
  21.     }
  22.      else if(331<=ww||ww<=500)
  23.     {
  24.     cout<<"3.61元"<<endl;
  25.     }
  26.      else if(501<=ww||ww<=700)
  27.     {
  28.     cout<<"4.48元"<<endl;
  29.     }
  30.     else if(701<=ww||ww<=1000)
  31.     {
  32.     cout<<"5.03元"<<endl;
  33.     }
  34.     else if(ww<1001)
  35.     {
  36.     cout<<"5.28元"<<endl;
  37.     }
  38.     }
  39.     system("pause");
  40.     return 0;
  41. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int math=0;
  7.     int ww=0;
  8.     cout<<"請輸入本期月份:"<<endl;
  9.     cin>>math;
  10.     cout<<"請輸入本月用電量:"<<endl;
  11.     cin>>ww;
  12.     if(math<=5||math>=10)
  13.         {
  14.             if(ww<=120)
  15.             {
  16.                 cout<<"本月用電量每度2.1元"<<endl;
  17.             }
  18.             if(ww>=121&&ww<=330)
  19.             {
  20.                 cout<<"本月用電量每度2.68元"<<endl;
  21.             }
  22.             if(ww>=331&&ww<=500)
  23.             {
  24.                         cout<<"本月用電量每度3.61元"<<endl;
  25.             }
  26.             if(ww>=501&&ww<=700)
  27.             {
  28.                 cout<<"本月用電量每度4.48元"<<endl;
  29.             }
  30.             if(ww>=701&&ww<=1000)
  31.             {
  32.                 cout<<"本月用電量每度5.03元"<<endl;
  33.             }
  34.             if(ww>=1001)
  35.             {
  36.                 cout<<"本月用電量每度5.28元"<<endl;
  37.             }
  38.         }
  39.         else if(math>=6||math<=9)
  40.         {
  41.             if(ww<=120)
  42.             {
  43.             cout<<"本月用電量每度2.1元"<<endl;
  44.             }
  45.             if(ww>=121&&ww<=330)
  46.             {
  47.             cout<<"本月用電量每度3.02元"<<endl;
  48.             }
  49.             if(ww>=331&&ww<=500)
  50.             {
  51.             cout<<"本月用電量每度4.39元"<<endl;
  52.             }
  53.             if(ww>=501&&ww<=700)
  54.             {
  55.              cout<<"本月用電量每度5.44元"<<endl;
  56.             }
  57.            if(ww>=701&&ww<=1000)
  58.             {
  59.              cout<<"本月用電量每度6.16元"<<endl;
  60.             }
  61.             if(ww>=1001)
  62.             {
  63.             cout<<"本月用電量每度6.71元"<<endl;
  64.             }
  65.         }
  66.     system("pause");
  67.     return 0;
  68. }
複製代碼

TOP

返回列表