Question: What is missing from this code? Question: Using the Pythagorean Theorem, calculate the hypotenuse of a right triangle given the length of the two shorter

What is missing from this code?

Question:

Using the Pythagorean Theorem, calculate the hypotenuse of a right triangle given the length of the two shorter sides. Be certain to use the square and squareRoot functions from the Gentle Introduction* textbook. (You will need to change the square function to use floating point numbers though.) Ask the user if s/ he wants to keep entering data; if "Yes" then continue prompting and calculating. Assume no sides are negative. Solving this might involve some research on your part! Use the following sample as a guide:

Enter side A: 3 Enter side B: 4 Side C is 5 Continue? yes Enter side A: 33 Enter side B: 44 Side C is 55 Continue? no 

My Code:

#include #include using namespace std; float squareRoot(float s) { float xn; if (s == 0) { xn = 0; } else { xn = s / 2.0; int counter = 1; while (counter >sideA; cout>sideB; cout>answer; cout

Output vs Expected output:

What is missing from this code? Question: Using the Pythagorean Theorem, calculate

2. Compare output ves Input 55.5 66.6 no Enter side A: 3.3 Enter side B: 4.4 Side Cis 5 Continue? yes Your output Enter side A: 55.5 Enter side B: 66. Side C is 85.9128 Continue? no Enter side A: 3.3 Enter side B: 4.4 Side C is 5 Continue? yes Expected output Enter side A: 55.5 Enter side B: 66. Side C is 86.6938 Continue? no

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!