Star program using a do while loop

I am trying to make a star (*) program while using a couple nested do while loops. The only loops that I want to use are do while loops.

The expected output should be

*
**
***
****
*****
******
*******
********
*********
**********
with the bottom row consisting of 10 stars. I was able to create this code using nested for loops, however I can't seem to do it while using specifically do while loops.

Here's the code using for loops.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;
int main()
{

		for (int b = 1; b <= 10; b++) //rows
		{
			for (int a = 1; a <= b; a++) //columns
			cout << "*"; //ouputs the *
			cout << endl;
		}
system ("pause");
return 0;
}
	
What did you try with do while?
have you try this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
	
int b = 1;
	do
	{
		int a = 1;
		do
		{
			cout << "*"; 
			a ++;
		}while(a<=b);

		cout << endl;
		b ++;
	} while(b<=10);
Topic archived. No new replies allowed.