Guest User

Untitled

a guest
Jun 13th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. cout << "Histograms:" << endl << endl;
  2.    
  3.     for (count = 0; count < numChoices; count ++)
  4.     {
  5.         cout << count + 1 << ": ";
  6.        
  7.         percentage = (survey[count] / (double) total) * 100;
  8.         even = (int)(percentage + 0.5) / 2;
  9.        
  10.         if (even > 0)
  11.         {
  12.             for (stars = 0; stars < even; stars ++)
  13.             {
  14.                 cout << "*";
  15.             }
  16.         }
  17.  
  18.         if ((int)(percentage + 0.5) % 2)
  19.         {
  20.             cout << "+";
  21.         }
  22.         cout << endl;
  23.        
  24.     }
  25.  
  26.     cout << endl;
  27.     cout << "* = 2%, + = 1%" << endl;
Add Comment
Please, Sign In to add comment