fork(2) download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. const int TreeSize = 7; //since it it used more than once, it should be simple to change
  6. for(int x = 0; x < TreeSize; ++x)
  7. {
  8. for(int y = TreeSize; y > x; --y)
  9. {
  10. std::cout << " ";
  11. }
  12. for(int y = 0; y < x; ++y)
  13. {
  14. std::cout << "*";
  15. }
  16. std::cout << std::endl;
  17. }
  18. }
  19.  
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
       
      *
     **
    ***
   ****
  *****
 ******