Program Logic

Apr 7, 2009 at 12:09pm
Hi there i'm trying to find the logic behind the following question.

Write a C++ program with a nested loop structure that displays the following pyramid in "*":

******
********
**********
************
**************
****************
*****************
********************

It is supposed to be a pyramid built in *'s the first row starting with 6 and the last row with 20 stars.

Last edited on Apr 7, 2009 at 12:14pm
Apr 7, 2009 at 12:20pm
This is a problem that every intro programming class introduces. Take a look at the various looping techniques here: http://www.cplusplus.com/doc/tutorial/control.html

Try it first. Then, if you run into a specific problem, people will be happy to help.
Apr 7, 2009 at 5:05pm
Here is a hint:

Two for-loops.

The outer loop starts at 6 and goes to 20.

The inner loop starts at 0 and goes to the outer loop value

You figure out how to make the stars print.
Last edited on Apr 7, 2009 at 5:05pm
Topic archived. No new replies allowed.