Advertisement
AndriikoM

Лекція 3, завдання 4

Oct 30th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a[5];
  8.     int max=a[0];
  9.     for ( int i = 0; i < 5; i++ )
  10.     {
  11.         cout << "Zirochok v "<< i+1 << "-omu stovptsi: ";
  12.         cin >> a[i];
  13.     }
  14.     for (int i=0; i<5; i++)
  15.     {
  16.         if (a[i] > max)
  17.         {
  18.             max = a[i];
  19.         }
  20.     }
  21.     for (int i=0; i<max; i++)
  22.     {
  23.         int c=max;
  24.         int d;
  25.         for (int j=0; j<5; j++)
  26.            {
  27.             if (a[j]>0)
  28.             {
  29.                 cout << "*";
  30.                 c--;
  31.             }
  32.             else
  33.             {
  34.                 cout << " ";
  35.             }
  36.             a[j]--;
  37.             }
  38.         cout<< endl;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement