Question: step 3 please. additional information above if needed. pe 4.2 ASCII Arti The final product of this assignment, tri.cpp, will be built up in 3

 step 3 please. additional information above if needed. pe 4.2 ASCII

Arti The final product of this assignment, tri.cpp, will be built up

in 3 parts. [Step 1] A right triangle could be drawn using

step 3 please. additional information above if needed.

pe 4.2 ASCII Arti The final product of this assignment, tri.cpp, will be built up in 3 parts. [Step 1] A right triangle could be drawn using the "* ASCIl 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 'In' or endl character in every string that you print via cout. You should get a triangle similar to the one shown below Y axis X axis 01 [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 particula r value of . 30 Derive a mathematical expression for the length of the x-axis (ie, # of *'s) as a function of e 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 progra m should prompt the user for the value of theta LayoutTell me what you want ta do they would like to use. Since the user is inputting a value in degrees, but the trigonometric functions in cmath use radians, you'll have to convert them. The built-in constant M PI can be useful for this [Step 3] Modify the program in step 2 so that if the xcoordinate (the number of *'s you print on a line] for any line falls within the range 20 s x s 30 then only print a line with exactly 20 s rather than the calculated value of x. This will make a sharp vertical cliff in the triangle for same number of lines (maybe none if theta is small) and then resume along the original diagonal line. Compile and test your program. o For Step 3 30 Here are some sample outputs Last Revised: 1/27/201

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!