Ychenik

Отцентрированая фигура

Mar 23rd, 2019 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int t[20] = {0};
  8.     int a;
  9.     int Max = 0;
  10.     for(int i = 0; i < 20; i++)
  11.     {
  12.         cout << "skolbko zvezd ctroke " << i + 1 <<", tolbko chotnue chisla, pishu 0 = konec, ili 20-e konec ";
  13.         cin >> t[i];
  14.         a = t[i];
  15.         if(t[i] > Max)
  16.         {
  17.             Max = a;
  18.         }
  19.         if(t[i] == 0)
  20.         {
  21.             break;
  22.         }
  23.     }
  24.     a = 0;
  25.     while(t[a] != 0)
  26.     {
  27.         for(int i = 0; i < (Max - t[a]) / 2; i++)
  28.         {
  29.             cout << " ";
  30.         }
  31.         for(int j = 0; j < t[a]; j++)
  32.         {
  33.             cout << "*";
  34.         }
  35.         cout << endl;
  36.         a++;
  37.     }
  38. }
Add Comment
Please, Sign In to add comment