Advertisement
Guest User

hw, 4 задача, массивы

a guest
Mar 1st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. using namespace std;
  2.  
  3. int main()
  4. {
  5.     int a[5];
  6.     int max = 0;
  7.     cout << "Vvedite 5 chisel";
  8.     for (int i=0; i<5; i++)
  9.     {
  10.  
  11.         cin >> a[i];
  12.  
  13.  
  14.     }
  15.  
  16.     for (int i = 0; i < 5; i++)
  17.     {
  18.         if (max < a[i])
  19.         {
  20.             max = a[i];
  21.         }
  22.     }
  23.  
  24.  
  25.     for (int i = 0; i < max; i++)
  26.     {
  27.  
  28.         for (int j = 0; j < 5; j++)
  29.         {
  30.             if (a[j] > i)
  31.             {
  32.                 cout << "*";
  33.             }
  34.             else
  35.             {
  36.                 cout << " ";
  37.             }
  38.  
  39.         }
  40.         cout << endl;
  41.     }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement