The main idea is to use a loop that runs 5 times. Each time through the loop represents one line of output. I'll control how many stars appear on each line by running another loop inside the first one.
You'll notice a pattern: line number equals star count. Line 1 gets 1 star, line 2 gets 2 stars, and so on. This means I can use the same variable that tracks which line I'm on to control the star count.
After printing all the stars for one line, I'll use cout with endl to move to the next line. This creates the triangle shape you want to see on the screen.