#include <iostream>
usingnamespace std;
void printTriangle(int);
void drawBar(int);
void printTriangle(int, char);
void drawBar(int, char);
int main()
{
int size = 0;
cout << "This program draws a Triangle";
cout << "Enter the Triangle base size: " << endl;
cin >> size;
printTriangle(size);
return 0;
}
void printTriangle(int sz)
{
for (int i = 0; i <= sz; i++)
{
drawBar(i);
cout << endl;
}
return;
}
void drawBar(int s)
{
for(int i = 0; i <= s; i++)
{
cout << "*";
}
cout << endl;
return;
}
void printTriangle(int ss, char symbol)
{
cout << "Enter a character: ";
cin >> symbol;
for(int i = 0; i <= ss; i++)
{
cout << "symbol" << symbol << endl;
}
return;
}
void drawBar(int ss, char c)
{
cout << 'c';
for(int i = 0; i <= ss; i++)
{
cout << 'c';
}
cout << endl;
return;
}
The problem is when I go to run this only the first triangle displays. Here is a little about what it is supposed to do.
Create a function that tests both version of the drawbar function to ensure they work correctly. Each of your drawbar functions should draw a triangle, so your program solution should output two triangles.
Remove line 24, you are already printing the newline in drawBar
Replace line 45 with an appropriate call of drawBar
Remove line 51, on line 54 you should print c variable, not 'c' ( character literal )
You are never calling the second overload of drawTriangle in main.