hi i am having trouble creating a series if triangles the number of triangles depsned on the users inout here is what i have so far any help would be great i ahve been at this for days. i know its the loop but i just cant see the problem.
#include <iostream> // using the main library
using namespace std;
// Function declarations
char this_char () ;
int get_num_tri () ;
void draw_tri ( char this_char, int num_tri ) ;
int main ()
{
char this_char = '*' ;
// Get number of triangles
int num_tri ;
num_tri = get_num_tri () ;
// Draw triangles
draw_tri ( this_char, num_tri ) ;
return 0 ;
}
// Funtion to get user to input number of triangles.
int get_num_tri ()
{
int num_tri ;
cout << " Please enter the number of triangles you would like " << endl ;
cin >> num_tri ;
return num_tri ;
}
// Function to draw triangles.
void draw_tri (char this_char , int num_tri )
{
for ( int i = 1 ; i <= num_tri ; i ++ )
{// Nested loop.
for ( int j = 1 ; j <= i ; j ++ )
{
cout << " * " ;
}
cout << endl << endl ;
}
}