I am trying to create a function that outputs a triangle. I have this one below that creates a square and need something similar that creates a triangle. Any help would be much appreciated. I can't seem to figure it out.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void draw_square(char &character, int &start_size, int &end_size){
int size = start_size;
while(start_size != end_size + 1){
for (int row = 1; row <= size; row++){
for (int col = 1; col <= size; col++){
if (row > 1 && row < size && col > 1 && col < size){
cout << " ";
}
else{
cout << character;
}
}
cout << endl;
}
size++;
start_size++;
}
}