Advertisement
_Kripaka001_

functions Tree 3

Jul 28th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void vivesti(int arrayInt, char symbol){
  6.     int i = 0;
  7.     while(i<arrayInt){
  8.             cout << symbol;
  9.             i++;
  10.         }
  11. }
  12.  
  13. void stebelko(int probel, char symbol){
  14.     int i = 0;
  15.     while(i < probel){
  16.         cout << symbol;
  17.         i++;
  18.     }
  19.     cout << "*";
  20. }
  21.  
  22. void sdelatElku(int userNum){
  23.     int i=0, arrProbel, arrZvezda;
  24.     char symbol;
  25.     while(i < userNum*2){
  26.         symbol = ' ';
  27.         arrProbel = userNum-(i/2);
  28.         vivesti(arrProbel, symbol);
  29.  
  30.         symbol = '*';
  31.         arrZvezda = i+1;
  32.         vivesti(arrZvezda, symbol);
  33.  
  34.         cout << endl;
  35.         i+=2;
  36.     }
  37.     symbol = ' ';
  38.     arrProbel = userNum;
  39.     stebelko(arrProbel,symbol);
  40. }
  41.  
  42.  
  43. int main()
  44.  
  45. {
  46.  
  47.    int userNumber,i,j;
  48.  
  49.     while(1>0){
  50.     cout << " Enter number to build a tree - ";
  51.     cin >> userNumber;
  52.     cout << endl;
  53.  
  54.     sdelatElku(userNumber);
  55.  
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement