* *** ***** ******* ********* void DrawPyramid(unsigned int height) { if (height == 0) return; int spaces = height - 1; int stars = 1; while (spaces >= 0) { for (int i = 0; i < spaces; i++) cout << " "; for (int i = 0; i < stars; i++) cout << "*"; cout << endl; spaces--; stars += 2; } } |
Puzzles and Visuals >