@TheNoobie there's a reason I didn't write the code for him.
First, because I'm too lazy to do it.
Second and most importantly he will not learn anything by copying code and compiling it.
The reason you could solve that yourself is:
a) it's not difficult.
b) Back in the days someone presented you with a simple challenge like that and you've struggled with it until you've beaten it, please let other do so as well.
Back on topic:
I suppose you're still not confortable or haven't learn functions yet.
That's almost it. Try and give more descriptive names to vars as andy told you.
So it should be something like this:
I assume that you store the input from the user to a variable called
number_of_lines
1 2 3
|
for(int line = 1; line <= number_of_lines; line = line +1){
//print your **** here.
}
|
Try using the piece of code I given you before
cout<<string(6, '*')
and change 6 to other numbers and see what happen. You can also use an int variable instead of a number, something like:
int myvar = 3;
cout<<string(myvar, '*'); Why don't you compile that and see what happens?