Advertisement
Ychenik

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

Jun 15th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void naricuiSpase(int str[], int Max, int i)
  6. {
  7.     for (int t = 0; t < (Max - str[i]) / 2; t++)
  8.     {
  9.         cout << " ";
  10.     }
  11. }
  12.  
  13. void narisuiZvezdy(int str[], int i)
  14. {
  15.     for (int f = 0; str[i] > f; f++)
  16.     {
  17.         cout << "*";
  18.     }
  19. }
  20.  
  21. void naricuiFigyry(int str[], int Max, int kolichestvoStrok)
  22. {
  23.     for(int i = 0; i < kolichestvoStrok; i++)
  24.     {
  25.         naricuiSpase(str, Max, i);
  26.         narisuiZvezdy(str, i);
  27.         cout<< endl;
  28.     }
  29. }
  30.  
  31. int vuchecliMax( int str[] )
  32. {
  33.     int Max = 0;
  34.     for(int j = 0; str[j] != 0; j++)
  35.     {
  36.         if(str[j] > Max)
  37.         {
  38.             Max = str[j];
  39.         }
  40.     }
  41.     return Max;
  42. }
  43.  
  44. int main()
  45. {
  46.     int i = 0;
  47.     int str[20];
  48.     while(i < 20)
  49.     {
  50.         cout << "skolbko zvezd ctroke " << i + 1 <<", tolbko chotnue chisla, pishu 0 = konec, ili 20-e konec ";
  51.         cin >> str[i];
  52.         if(str[i] == 0)
  53.         {
  54.             break;
  55.         }
  56.         i++;
  57.     }
  58.     naricuiFigyry(str, vuchecliMax(str), i);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement