Nested Loops

Use nested loops to output 6 rows of 7 stars in each row.

using namespace std;

int main()
{
int i = 0;
while(i++ < 7)

{
int j =0;
while(j++< 7) //stars
{
cout<<"*";

cout<<endl; //end of row
}

system("pause");
return 0;
}


I was just playing around with it. Help would be very appreciated. Thank you.
You're missing
 
#include <iostream> 


You're printing the same number of rows and columns.

You're missing a } on the inner loop. You would have seen this if had some sensible indentation.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Last edited on
Topic archived. No new replies allowed.