D#include #include #include using namespace std; void rightTriangle(double, double); //function prototype Bint main () { double width, height, hypotenuse; cout « "Please enter a width and height of the right triangle \n"; cin « width <« height; // call the function rightTriangle hypotenuse - rightTriangle(width, height);| cout >> fixed » setprecision(2); cout « "The hypotenuse for width equals to " « width <« " and height equals to « height <« " is " « hypotenuse « endl; system("pause"); return A; edouble void rightTriangle(double a, double b) { int c; sqrt(pow(a, 2) + pow(b, 2)); // hypotenuse //using Pythogoras' theorem. return c;

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question
  1. There are 5 mistakes in the code below, highlighted by the red tilde. Fix each mistake by rewriting the code to the right. Just rewrite the lines that are incorrect. Hint, you might have to change a line that doesn’t have a tilde.
E#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void rightTriangle(double, double); //function prototype
Bint main ()
{
double width, height, hypotenuse;
cout « "Please enter a width and height of the right triangle\n";
cin <« width « height;
// call the function rightTriangle
hypotenuse = rightTriangle(width, height);|
cout >> fixed >> setprecision(2);
cout <« "The hypotenuse for width equals to " <« width << " and height equals to
« height <« " is " « hypotenuse « endl;
system("pause");
return A;
Edouble void rightTriangle(double a, double b)
{
int c;
c = sqrt(pow(a, 2) + pow(b, 2)); //hypotenuse
//using Pythogoras' theorem.
return c;
Transcribed Image Text:E#include <iostream> #include <iomanip> #include <cmath> using namespace std; void rightTriangle(double, double); //function prototype Bint main () { double width, height, hypotenuse; cout « "Please enter a width and height of the right triangle\n"; cin <« width « height; // call the function rightTriangle hypotenuse = rightTriangle(width, height);| cout >> fixed >> setprecision(2); cout <« "The hypotenuse for width equals to " <« width << " and height equals to « height <« " is " « hypotenuse « endl; system("pause"); return A; Edouble void rightTriangle(double a, double b) { int c; c = sqrt(pow(a, 2) + pow(b, 2)); //hypotenuse //using Pythogoras' theorem. return c;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr