#include <iostream>
using namespace std;
int main() {
// Outer loop: runs 5 times for 5 lines
for (int line = 1; line <= 5; line++) {
// Inner loop: prints line number of stars
for (int star = 1; star <= line; star++) {
cout << "*";
}
// Move to next line
cout << endl;
}
return 0;
}
``` The outer for loop controls which line I'm printing. The inner loop runs exactly 'line' times, printing one star each time. After all stars for a line are printed, endl creates a line break so the next line starts fresh. The outer loop controls rows, the inner loop controls what prints in each row. This dependency creates the pattern.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/cpp/getting-started/print-pattern-implementation
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████████████████████████████████████████████████████████████████████