Write a C++ program that consists of the main function and three user-defined functions.
The program prompts the user to choose from a menu whether to display a ‘sideway triangle’, or display a 'big X',
or to quit the program. After user’s selection, the program prompts the user to input:
1. A character to be used to draw the selected shape, and
2. The height (in lines on the screen) of the shape to draw. The height must be an odd positive number and your
program must check the user input for validity and not proceed until the height is entered correctly.
Can anyone tell me where I went wrong? It is not displaying correctly.
In sideways triangle, you need to put some curly brackets and a cout<<endl;
1 2 3 4 5 6 7 8
void drawSidewayTriangle(char character, int size) {
for (int row = 0; row <= size; row++)
{
for (int col = 0; col <= row; col++)
cout << character;
cout<<endl;
}
}
Similar thing in BigX. Put curly brackets after line 84 till the end of line 91. Otherwise you are executing only one command (line 91 should be executed after each row)