I am working on a project for my class right now, but I am stuck. I am supposed to draw a rocket on the screen, using functional decomposition. The rocket is basically a cone, a variable number of rectangles, and another cone. The cone has to fit for all kinds of numbers. I got the part for the even numbers, but for the odd numbers it doesnt quite fit. I am supposed to have one star at the top (for the odd numbers) but I am having two. Here is the code for the odd numbers:
{
width=(width/2)+1;
int count,count1;
for (count=1; count<=width; count++)
{
for (count1=width-count; count1>=1; count1--)
{ cout <<" "; }
cout <<"*";
for (count1=2; count1<=count*2-2; count1++)
{cout << " "; }
cout <<"*"<<endl;}
}
Any hint on how to get rid of that one star would be greatly appreciated.
This is what the rocket looks like for even numbers:
Enter width of the rocket: 6
Enter height of the rocket: 7
Enter how many stages you wish to display: 2
--*--*--
-*----*-
*------*
******
*------*
*------*
*------*
*------*
*------*
******
******
*------*
*------*
*------*
*------*
*------*
******
--*--*--
-*----*-
*------*
Press any key to continue . . .
Thank you.

New Topic/Question
Reply




MultiQuote




|