Example 1 — Grow a row with a char loop
The outer char is the last letter on the row. The inner loop restarts at 'A'.
#include <iostream>
using namespace std;
int main() {
for (char end = 'A'; end <= 'E'; end++) {
for (char letter = 'A'; letter <= end; letter++)
cout << letter;
cout << '\n';
}
return 0;
} How It Works
endruns from'A'to'E', one row per letter.- The inner loop prints
'A'throughend, so the row is A…end. cout << letterstays on the line;cout << '\n'starts the next row.

