Hi I'm new to programing. My tearcher gave me a ster program where there are 4 right triangles, that triangles 2-4 are just reflections/rotations of the first one - all being right triangles of size 10 on the perpendicular sides
*
**
***
****
*****
******
*******
********
*********
**********

this is what I have

int r, c;

	for (r=1; r<=10; r++)
	{
		for (c=1; c<=r; c++)
			cout<<"*";
		cout<<endl;
	}
	cout<<endl;
 
	for (r=10; r>=1; r--)
	{
		for (c=1; c<=r; c++)
			cout<<"*";
		cout<<endl;
	}
	cout<<endl;

please help with the other 2

>>2-4 are just reflections/rotations of the first one
That tells us nothing.

>>please help with the other 2
And you can't count either because 4 - 1 != 2 :)

this is what they need to look something like

*                                  *       **********      **********
**                               **       *********         *********
***                            ***       ********            ********
****                         ****       *******               *******
*****                      *****       ******                  ******
******                   ******       *****                     *****
*******                *******       ****                        ****
********             ********       ***                           ***
*********          *********       **                              **
**********       **********       *                                 *

sorry I can't help, my computer teatcher gave me the same program and I am stcuk with u

To do the second one just print spaces before the stars.

can you please show me how to do one of the two PLEASE?

can you please show me how to do one of the two PLEASE?

Sure -- here is the first line

for(int i = 0; i < 15; i++) // number of spaces to display
  cout << ' '; // display one space
cout << '*';  // finally display the asterisk

you can also do it using C functions

char line[126];
sprintf(line,"%15.15s", "*");
cout << line;

Like this

for (r=10; r>=1; r--)
{
for (c=1; c<=r; c++)
		
for(int i = 0; i < 15; i++) // number of spaces to display
cout << ' '; // display one space
cout << '*';  // finally display the asterisk
cout<<endl;
}
cout<<endl;

because it does not work, whats wrong

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.