If this gives you a triangle, it should be really easy to get a second one with just another for loop. all you need to do is repeat this code again.
so ...
I am so new at programming period. This is my first ever class of it. I can't seem to get the triangles on top of each other because I can only use 3 FOR loops. I can get it to work with no problems using 4 FOR loops but not 3. I keep getting this solution:
This is what Darkmaster had suggested (three loops):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
int main()
{
int n = 10 ;
int ntriangles = 2 ;
for( int i = 0 ; i < ntriangles ; ++i )
{
for( int a = 1 ; a <= n ; ++a )
{
for( int b = 1 ; b <= a ; ++b ) std::cout << '*' ;
std::cout << '\n' ;
}
}
}