#include <iostream> int drawBar(int); int main() { std::cout << std::endl << \"L
ID: 3625930 • Letter: #
Question
#include <iostream>int drawBar(int);
int main()
{
std::cout << std::endl << "Let's Draw a triangle! ";
//determine how many lines will be drawn
int triangleBase = 0;
//draw the triangle
for (int i = 0 ; 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 = 0;
while (theCounter >= barSize) {
theCounter--;
std::cout << '*';
}
std::cout << ' ';
return 0;
} //end drawBar
Explanation / Answer
please rate - thanks
you didn't say what you need so here are 2 choices
#include <iostream>
int drawBar(int);
int main()
{
std::cout << std::endl << "Let's Draw a triangle! ";
//determine how many lines will be drawn
int triangleBase = 10;
//draw the triangle
for (int i = 0 ; i< triangleBase ; i++) {
drawBar(i);
}
system("pause");
return 0;
} //end main
int drawBar(int barSize) {
//draws a line of asterisks
//the number of asterisk drawn equals barSize
int theCounter = 0;
while (theCounter <= barSize) {
theCounter++;
std::cout << '*';
}
std::cout << ' ';
return 0;
} //end drawBar
-------------------------------------------
#include <iostream>
int drawBar(int);
int main()
{
std::cout << std::endl << "Let's Draw a triangle! ";
//determine how many lines will be drawn
int triangleBase = 10;
//draw the triangle
for (int i = triangleBase ;i>=0; i--) {
drawBar(i);
}
system("pause");
return 0;
} //end main
int drawBar(int barSize) {
//draws a line of asterisks
//the number of asterisk drawn equals barSize
int theCounter = 0;
while (theCounter <= barSize) {
theCounter++;
std::cout << '*';
}
std::cout << ' ';
return 0;
} //end drawBar
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.