Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help with STEP 3. Output should look similiar to picture at the bottom. Thank you! Step 1] A right triangle could be drawn using the
Help with STEP 3. Output should look similiar to picture at the bottom. Thank you!
Step 1] A right triangle could be drawn using the '* ASClIl character and the cout function by using two for loops (one nested inside the other with the outer loop counting lines and the inner loop counting characters per line). Write a program to print out the *'s to form an isosceles right triangle 31 rows high (i.e. 1* on row 0, 2 *s on row 1, etc.). Note: You do not have to put a ' n ' or endl character in every string that you print via cout. You should get a triangle similar. to the one shown below. X axis 0 Step 2] Except for distortions in the proportion of a characters height/width (i.e. the font that Linux uses), the triangle above should be an isosceles triangle (i.e. 45 degrees for each of the non-right angles). We could generalize and pick an arbitrary number of degrees for the angle, , shown below. Assume 15 75 and that the height of the triangle will be 31 text lines running from a y-axis value of 0 to 30 (inclusive). Modify your program from step 1 to now query the user for a value of O between 15 and 75 (you can assume they will always comply and not give you a bad value) then print a triangle given a particular value of . 30 Derive a mathematical expression for the length of the x-axis (ie, # of *'s) as a function of and the y-coordinates. Then iterate through every line (y-coordinate) and calculate the appropriate x-coordinate (round down to get an integral value using the floor () function in cmath, if desired). The X-coordinate you compute will directly determine how many '*'s are printed. Your program should prompt the user for the value of thetaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started