Question: 4. 1Illiiirite a CH program for the following problem. Prompt the user to enter the x and v coordinates of the three corner points in

 4. 1Illiiirite a CH program for the following problem. Prompt theuser to enter the x and v coordinates of the three corner

4. 1Illiiirite a CH program for the following problem. Prompt the user to enter the x and v coordinates of the three corner points in a triangle and then display the triangle's angles pt, B. and C in the diagram below}. A I tonsil: ' 1 - b ' b - c ' or E {-2 ' b ' cl} B=acuslh*h-a*ec:*c"luj'{2*a*cl} C = acostlc ' c - b * b - a * ar 3 (-2 * a * bl} lel 'r'ou can compute the value of a [in the diagram above} bv measuring the straightline distance between points [x2,v2} and {33.1.8} in the diagram above. Similarly, b and c can be computed by using the appropriate points [see diagram above]. Angles it, B and {I should be kept in double tvpe variables, displaved in degrees, rounded to 3 decimal places of accuracv prior to display. Then prompt the user to enter the x- and y- coordinates of three corner points of a second triangle, display the triangle's angles (as you did for the first one), and then compare whether the angles of both the triangles are equal (in any order, for example if the first triangle has angles 50, 30 and 100 and the second triangle has angles 100, 50, and 30 then both the triangles are deemed to have the same three angles. However, if the second triangle has angles 50, 40 and 90 then the two triangles do not have the same three angles). Checking if two double values are the same or not should not be done using the == operator as it may produce erroneous results (not all real numbers in base 10 have an exact representation in binary (base 2)). Use the following idea instead. We can check if two double values (num1 and num2) are equal by first taking the absolute difference between num1 and num2 and checking if this difference is less than 0.000001. If yes, then we say that num1 and num2 are equal; otherwise they are not. It will be beneficial to have this comparison available to you as a function. Write the body of the following function and place it before the main function in your cpp file. bool SafeDblEquals(double num1, double num2){ // this function returns true if | num1 - num2 | is less than 0.000001; // otherwise it returns false. // here is a demo usage of this function. Assume x and y are double type variables // if (SafeDblEquals(x, y) == true){ // x is equal to y so do something

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 Programming Questions!