//PURPOSE: This program draws an up-side-down isosceles triangle. //The base of
ID: 3655748 • Letter: #
Question
//PURPOSE: This program draws an up-side-down isosceles triangle. //The base of the triangle and the character to fill will be // provided as input. The base should be an odd number and the height of the triangle will be depend on the base. // For example, the isosceles triangle with base 5 is // ***** // *** // * #include #include using namespace std; int main () { //local variables int base; // the size of the base char symbol; // the character to fill int space; // the counter for spacing // Read the character to fill cout << "Enter the character to fill the triangle: "; cin >> symbol; // Read the size of the base of the triangle, the size should be odd. do { cout << "Enter the base (odd number) of the triangle:"; cin >> base; } while (base/2*2 == base); // Use a nested for loop to draw the upside down triangle with base size. // the outer loop will control each line and the number of leading spaces for (________________________________________________) { // draw leading spaces for (____________________________) cout << " "; // draw a line with symbol for (____________________________) cout << symbol; cout << endl; } return 0; }Explanation / Answer
#include#includeusing namespace std; int main () { int base; char symbol; int space; cout> symbol; do { cout> base; } while(base/2*2 == base); for(int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.