Advertisement
Balda

Untitled

Jan 16th, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double counting(int a);
  5.  
  6. int main()
  7.  
  8. {
  9.     setlocale(LC_ALL, "Russian");
  10.     int a;
  11.     cout << "Введите количество потребляемой энергии: ";
  12.     cin >> a;
  13.     cout << "Цена электроэнергии: " << counting(a) << endl;
  14. }
  15.  
  16. double counting(int a)
  17. {
  18.     if (a >= 500)
  19.         return (200 * 54 + 300 * 70 + (a - 500) * 91) / 100;
  20.     else if ((a >= 200) && (a < 500))
  21.         return (200 * 54 + (a - 200) * 70) / 100;
  22.     else if (a < 200)
  23.         return a * 54 / 100;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement