fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4.  
  5. int main () {
  6.  
  7. int height;
  8. std::cin >> height;
  9.  
  10. for(int row = 0; row + 1 < height*2; row++) {
  11. std::cout << std::string(6 - abs(row - height + 1), ' ')
  12. << std::string(2*abs(row - height + 1) + 1, '*')
  13. << std::endl;
  14. }
  15. }
Success #stdin #stdout 0s 4288KB
stdin
7
stdout
*************
 ***********
  *********
   *******
    *****
     ***
      *
     ***
    *****
   *******
  *********
 ***********
*************