Advertisement
dllbridge

books_27_May_22

May 27th, 2022
619
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. #include   <iostream>
  4. using namespace std;
  5.  
  6.  
  7.  
  8.  
  9. ////////////////////////////////////////////////////
  10. int main()
  11. {
  12.     int book = 0, price = 1000, sum = 0, i = 0;
  13.     int count = 0;
  14.     cout << "press enter counts book: ";
  15.     cin >> book;
  16.  
  17.     while(i <= book)
  18.     {
  19.         switch (count)
  20.         {
  21.         case 0 : cout << i << " books = " << sum << '\n'; break;
  22.         case 1 : price = 1000;
  23.                  sum += price;
  24.                  cout << i << " books = " << sum << '\n'; break;
  25.         case 8 : price = 1000;
  26.                  sum += price;
  27.                  count = 1;
  28.                  cout << i << " books = " << sum << '\n'; break;
  29.         default: price -= 55;
  30.                  sum += price;
  31.                  cout << i << " books = " << sum << '\n';
  32.         }
  33.  
  34.         count++;
  35.         i++;
  36.     }
  37.  
  38.     return 0;
  39. }
  40.  
  41.  
  42.  
Advertisement
RAW Paste Data Copied
Advertisement