Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>

using namespace std;

int main() {
    int rows;
    int amount;
    cout << "Enter number of rows: ";
    cin >> rows;
    cout << endl;
    for (int i = 1, k = 0; i <= rows; ++i, k = 0) {
        for (int space = 1; space <= rows-i; ++space) {
            cout << "  ";
        }
        while (k != 2 * i -1) {
            cout << "| ";
            amount++;
            ++k;
        }
        cout << endl;
    } 
    return 0;
}