I'm having a little trouble with a basic loop. the loop needs to output a cone for the top and bottom of a rocket being cout'ed to the screen.
the output now is:
(centered on screen, of course)
*
**
***
****
*****
but needs to look like this:
(centered on screen, of course)
*
* *
* *
any suggestions?
here is my code:
void drawCone(int coneWidth)
{
int coneHeight = coneWidth/1.5;
//cout << coneHeight << coneWidth <<endl;
int count=1, innerCount=1;
while (count <= coneWidth)
{
innerCount=1;
while (innerCount <= (coneWidth+1 -count)/2)
{
cout << ' ';
innerCount++;
}
innerCount=1;
while (innerCount <=count)
{
cout << '*';
innerCount++;
}
cout << endl;
count++;
}
}
This post has been edited by mazer451: 28 July 2008 - 01:56 PM

New Topic/Question
Reply




MultiQuote


|