Create a function that when executed displays a line of asterisks across the screen. The function will have one parameter that is used to determine the number of asterisks to print. The functions prototype will be:
void drawBar(int);
Include a function used to test the drawBar function called printTriangle. This function will accept one argument that will be used to determine the number of asterisks used to form the base of the triangle. The user should be prompted to enter the base-size of the triangle. The prototype of the printTriangle will be:
void printTriangle(int);
When ran, the program will generate the following output:
Enter the triangle base size: 6
*
**
***
****
*****
******
I guess i really must not understand the void function because I can not seem to get this to work currectly! Any help would be great
#include <iostream>
using namespace std;
void printTriangle(int);
void drawBar(int);
int main()
{
int base = 0;
cout << "This program draws a Triangle" << endl;
cout << "\nEnter the triangle base size: ";
cin >> base;
printTriangle(base);
return 0;
}
void printTriangle(int bs)
{
drawBar(bs);
for (int i = 0; i <= (bs - i); i++);
}
void drawBar(int b)
{
for (int i = 0; i <= (b - i); i++);
cout << "*";
cout << endl;
}