my assignment is to make a triangel like so:
*
**
***
****
*****
I have done so but cannot get my command window to stay open. It pops up and closes right back out. heres my code can anyone help?
#include <iostream>
int drawBar(int);
int main()
{
std::cout << std::endl << "Let's Draw a triangle!\n";
//determine how many lines will be drawn
int triangleBase = 0;
//draw the triangle
for (int i = 5 ; i >= triangleBase ; i--) {
drawBar(i);
}
return 0;
} //end main
int drawBar(int barSize) {
//draws a line of asterisks
//the number of asterisk drawn equals barSize
int theCounter = 5;
while (theCounter >= barSize) {
theCounter--;
std::cout << '*';
}
std::cout << '\n';
return 0;
} //end drawBar