_Kripaka001_

exercise 3(c)№3

Apr 11th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int x,i,max,c;
  6.     int a[30];
  7.     i = 0;
  8.     c=0;
  9.     max = 0;
  10.     cout << "vvedi chislo cifer skolko ti hotheh vvesty "<< endl;
  11.     cin >> x;
  12.  
  13.     while (i < x)
  14.     {
  15.        cout << "vvedi chislo" << i+1;
  16.        cout << endl;
  17.        cin >> a[i];
  18.        cout << endl;
  19.        i++;
  20.     }
  21.  
  22.     i = 0;
  23.     while (i < x)
  24.     {
  25.        if (a[i] > max)
  26.        {
  27.           max = a[i] ;
  28.        }
  29.        i++;
  30.     }
  31.     i=0;
  32.     while (i < x)
  33.     {
  34.         a[i]++;
  35.         i++;
  36.     }
  37.  
  38.     i = 0;
  39.     while (i < max)
  40.     {
  41.             c=0;
  42.             cout << endl;
  43.        while (c < x)
  44.               {
  45.  
  46.                 if (a[i] > 1)
  47.                     {
  48.                         cout << "*" ;
  49.                         a[i] = a[i] - 1;
  50.                         c++;
  51.                     }
  52.                 else
  53.                     {
  54.                         cout << " " ;
  55.                         c++;
  56.                     }
  57.               }
  58.  
  59.        i++;
  60.     }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment