LOOPING

Hey guys im doing some basic programming
using loop statements my target is to produce an output like this:

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

but no luck? :(
here's my code:
#include<iostream.h>
char x;
main()
{
for(x=0;x<6;x++)
cout<<x;
return 0;
}

can you please help me? :(
You need a second nested loop. one for top down, one for left right. for the next line use cout<<endl;
Last edited on
Get a new compiler, one that's less than 5 years old!
Last edited on
Thanks man finally got it right! :D
Did you get my message? Get that right first!
Last edited on
no. i was using this old c++ because of my assignment in my class
but i have the latest c++ in my computer :)
And your school only has that old compiler?
Last edited on
1
2
3
4
5
6
7
8
#include<iostream.h>
char x; //this isn't in the right place
main()  //this line is incomplete
{
   for(x=0;x<6;x++)  //You need another one of these right below this line
     cout<<x;            //Just mess around with the code and you'll figure it out
   return 0;
}
Topic archived. No new replies allowed.