Display formatting

Hi, I am trying to make it to where I can out into a descending or ascending order. Like
1
2
3
4
5
6
**********
*********
********
*******
******
//so forth so on 
however I am having trouble, I have experimented with do while, for, while and various methods of each of doing so. Could someone send me in the right direction?
You'll need 2 for loops. One inside of the other.

The first one should go from 0 to the number of lines.
The second one should go from 0 to the index of the first one.

In the inner loop, print a *
After the inner loop, but within the second loop, print a \n or endl.
Hi there,

Please post some of the code you have tried and we'll go from there :)

All the best,
NwN
check this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int star;
	cout<<"Enter Stars = ";
	cin>>star;

	system("cls");

	for(int i = 0 ; i < star ; i++)
	{
		for(int j = 0 ; j <= i ; j++)
		{
			cout<<"*";
		}
		cout<<endl;
	}
this is to display stars in descending

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int star;
	cout<<"Enter Stars = ";
	cin>>star;

	int temp = star;

	system("cls");

	for(int i = 0 ; i < star ; i++)
	{
		for(int j = 0 ; j < temp ; j++)
		{
			cout<<"*";
		}
		temp--;
		cout<<endl;
	}
Nice, that works well--thanks!
Topic archived. No new replies allowed.