/******************************************************************************************** trirght.cpp Jim Millard for CO211/Fall 1999 Program that draws a right-justified right triangle (base up) with asterisks. The user will input the height, and the program will do the rest... ********************************************************************************************/ #include <iostream> #include <string> using namespace std; int main() { //define loop variables here to deal with incorrect scoping in MS VC++ int height, column, row; //inform and prompt the user cout << endl << "This program will draw an inverted, right-justified right triangle from\n" << "base to point using a height you provide." << endl << endl; cout << "Enter the triangle's height in rows: "; cin >> height; cout << endl; //output the triangle for (row = 0; row < height; row++) { cout << '\t'; //draw leading spaces, if needed for (column = 0; column < row ; column++) cout << ' '; //draw asterisks, picking up where the spaces ended for (column = 0; column < height-row; column++) cout << '*'; cout << endl; } return 0; }