Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- void printPyramid(int height) {
- char a('*');
- for (int i = 0; i < height; i++) {
- cout << setw(height - i) << a;
- for (int b = 0; b < (i * 2); b++) {
- cout << a;
- }
- cout << a << endl;
- }
- }
- int main() {
- int input;
- cout << "Enter height of pyramid: ";
- cin >> input;
- printPyramid(input);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement