Advertisement
dmaisano

Sales Bar Chart

Jul 28th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int sales[5] = {};
  7.     int counter = 1;
  8.  
  9.     for(int i = 0; i < 5; i++) {
  10.         cout << "Enter today's sale for store " << counter << ": $";
  11.         cin >> sales[i];
  12.         counter++;
  13.     }
  14.  
  15.     cout << "\nSALES BAR CHART\n(Each * = $100)\n";
  16.  
  17.     counter = 1;
  18.     for(int j = 0; j < 5; j++) {
  19.         int strix = sales[j]/100;
  20.         cout << "store " << counter << ": " ;
  21.         for(int k = 0; k < strix; k++) {
  22.             cout << "*";
  23.         }
  24.         cout << "\n";
  25.         counter++;
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement