Egor_Vakar

lab2(C++)

Sep 9th, 2021 (edited)
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     system("chcp 1251>nul");
  6.     cout << "Таблица цены сыра:" << endl << " ________________" << endl << "|цена  |стоимость|"
  7.          << endl << "|______|_________|" << endl;
  8.     int weight = 50, price = 280, price1;
  9.     for (weight; weight <= 1000; weight += 50)
  10.     {
  11.         price1 = weight * price / 1000;
  12.         cout << "|" << weight<<"г";
  13.         if (weight < 100)
  14.             cout << "   |" << price1 << "р      |" << endl;
  15.         else
  16.             if (weight < 400)
  17.                 cout << "  |" << price1 << "р      |" << endl;
  18.             else
  19.                 if (weight < 1000)
  20.                     cout << "  |" << price1 << "р     |" << endl;
  21.                 else
  22.                     cout << " |" << price1 << "р     |" << endl;
  23.         cout << "|______|_________|" << endl;
  24.     }
  25.     system("pause>nul ");
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment