Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++, please include step by step comments Problem Statement Write a program that asks the user to input an integer in the range [1,30] as

C++, please include step by step comments image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Problem Statement Write a program that asks the user to input an integer in the range [1,30] as the size n of a triangle, which is the number of lines in the triangle. Based on the size, you will create a function named drawTri () to print a triangle which contains one little star (asterisk symbol) at the first line, three little stars at the second line, and so on till 2n1 little stars at the nth line, and it is symmetric. For example, the triangle with size 5 are shown in the following: Create two more functions named drawTriR90 (), and drawTriR180 () that will draw TWO more triangles obtained after rotating the original ones 90 degrees and 180 degrees to the right, respectively. When size =5, for instance, functions drawTri (), drawTriR90 (), drawTriR180(), respectively, will print: //after 90 degree rotation to the right ** * //after 180 degree rotation to the right *** Your program will - repeatedly read the size of a triangle, which is in the range of [1,30], till the user input Q (or q) to stop your program - print the original triangle based on the user input size, and rotate it clockwise for 90 and 180 degrees, and print the rotated triangles respectively. * print a triangle of asterisk * It rotates the pattern from drawTri function, 180-degree clockwise or it rotates the pattern from drawTriR90 function, 90 -degree clockwise *eparam n int: representing how many rows of the original triangle before rotation *ereturn: void function */ void drawTriR180(int n) The following shows TWO sample outputs of running your program: Sample output 1: Enter the size of your triangle (integer in [1,30] ) Type Q to quit the program: size 5 is my choiced Invalid size! Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: Q Thank you, have a great day! Sample output 2 : Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: five as the sizew Invalid size! Enter the size of your triangle (integer in [1,30] ) Type Q to quit the program: 5 as the sizet The triangle with size 5 is: The rotation for 180 degrees clockwise: Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: 31 is that ok? The size is not in the correct range! Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: 5 is my guessel The size is not in the correct range! Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: 04 The size is not in the correct range! Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: 14 The triangle with size 1 is: The rotation for 90 degrees clockwise: The rotation for 180 degrees clockwise: Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: 7.5 is the sized The triangle with size 7 is: The rotation for 90 degrees clockwise: The rotation for 180 degrees clockwise: Enter the size of your triangle (integer in [1, 30]) Type Q to quit the program: 13 thirteent The triangle with size 13 is: The rotation for 90 degrees clockwise: The rotation for 180 degrees clockwise: Note that the blue part represents the user input, and " "" represents the return key from user input

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Discuss about training and development in India?

Answered: 1 week ago

Question

Explain the various techniques of training and development.

Answered: 1 week ago

Question

Explain the various techniques of Management Development.

Answered: 1 week ago