|
-
October 20th, 2011, 10:53 AM
#1
star shape using asterisk
im having a problem with my loop....
Im using borland c++ 6.0
and here is my assignment :
the output must be:
using nested loop....
----------------
----- *---------
---*****------
----***--------
---*-----*-------
-----------------
...... here is my code :
#include <iostream.h>
#include <conio.h>
main()
{
int x, y, z;
for (x = 1; x <= 1; x++) {
cout << " *" << "\n";
}
{
for (y = 1; y <= 5; y++) {
cout << "*";
}
}
getch();
}
-
October 20th, 2011, 11:05 AM
#2
Re: star shape using asterisk
You are outputting *s, but in order to make them line up that way, you must also output another character. You have shown - as this character here, but a space would also work.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|