HELP ASAP
Sep 17, 2015 at 12:39pm UTC
How to do this T.T Help me guys ASAP
____*
__***
*****
__***
____*
Sep 17, 2015 at 12:53pm UTC
Hi,
Please do not double post :+)
Sep 17, 2015 at 7:44pm UTC
Create a function that prints a single line. Use parameters for the total line length, and the number of stars in it:
1 2 3 4
writeLine(unsigned totalLength, unsigned numStars)
{
// write the code here
}
Now test it a little with this:
1 2 3 4 5 6 7 8 9
int main()
{
cout << "10,1\n" ;
writeLine(10, 1);
cout << "\n 10,7\n" ;
writeLine(10,7);
cout << "\n 5,1\n" ;
writeLine(5,1);
}
Now write code that uses writeLine() to create the figure. For this you will use TWO loops, not one. The first loop writes the top half of the triangle, the second loop writes the bottom half.
Topic archived. No new replies allowed.