HELP

Apr 1, 2013 at 3:05pm
#include <iostream>
using namespace std;

int main()
{
int n=1, a, x;

do
{
cout << "*";



do
{


for(a=1;a<=1;a++)

cout << "*"<<endl;

n++;



}
while(n<=8);

}while(n<=10);

return 0;
}



I need this do while loop to output *'s in a sequence twice. As so,
*
**
***
****
*****
******
*******
********
*********
**********
*
**
***
****
*****
******
*******
********
*********
**********
Please help. Thanks.
Apr 1, 2013 at 3:32pm
very easy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
using namespace std;
int main()
{
	int lines=10,repeat=2,number;
	for (int k=0;k<repeat;k++)
	{
		number=1;
		for (int i=0;i<lines;i++)
		{
			for (int j=0;j<number;j++)
			{
				cout << "*";
			}
			number++;
			cout << endl;
		}
	}
	system("pause");
}
Apr 1, 2013 at 5:15pm
That worked yes, but I need it to be a do while loop with a for inside, my instructions are 2 do while loops and 1 for loop?
Apr 1, 2013 at 5:17pm
Try to describe the problem in the header a bit better, just saying "HELP" doesn't give people much to go on. Not hating, just saying =]
Apr 1, 2013 at 5:29pm
translate a for in a while is a easy thing.. I couldn't understand what's the problem there...

@IceyEyez yeah.... "two times an half christmas tree" might work better :D
Last edited on Apr 1, 2013 at 5:30pm
Apr 1, 2013 at 5:59pm
or "HELP with a homework problem". Note that he posted his attempt and did not ask for a complete solution. Providing them for obvious homework problems is frowned upon on this site. It may be very easy for you but it doesn't help the poster learn anything.
Apr 1, 2013 at 6:34pm
closed account (3qX21hU5)
Not to mention he is teaching him to use system("pause"); :(. Never use system() anything. You will ask me why and I will just say "Because I said so" and point you here - http://www.cplusplus.com/forum/articles/11153/ ;p
Topic archived. No new replies allowed.