Question: #include #include #include using namespace std; void compute_rectangle (double width, double height); int main( ) double width, // width of the rectangle entered by the

#include #include #include using namespace std;

void compute_rectangle (double width, double height); int main( )

double width, // width of the rectangle entered by the user

height, // height of the rectangle entered by the user

area, // area of the given rectangle

perimeter, // perimeter of the given rectangle

diagonal; // diagonal of the given rectangle

cout

cin >> width;

cout

cin >> height;

compute_rectangle (width, height);

cout

cout

cout

return 0;

}

void compute_rectangle (double width, double height)

{

double area, perimeter, diagonal;

area = width * height;

perimeter = width * 2 + height * 2;

diagonal = sqrt (width * width + height * height);

} #include #include #include using namespace std; void compute_rectangle (double width, double height);

#include estdlib> #include #include cmath> 1.) Run the program. Why aren't the appropriate values printed for area, perimeter and diagonal (they seem to be given values in compute restangle)? using namespace std; void computerectangle (double width, double height) 2.) Make the following changes to the program so that the values will be returned from the function int main) double widhI width of the rectangle entered by the user heightII height of the rectangle entered by the user area, perimeter, 1/ perimeter of the given rectangle diagonalI diagonal of the given rectangle Il area of the given rectangle Change the call to: o diagonal, perimeter, area he width cout > width; cout > height; : Run your program. What is output by the program for each result? : Why will this strategy never work for this function? : Undo the above changes made in the program. compute rectangle (width, height); cout #include #include cmath> 1.) Run the program. Why aren't the appropriate values printed for area, perimeter and diagonal (they seem to be given values in compute restangle)? using namespace std; void computerectangle (double width, double height) 2.) Make the following changes to the program so that the values will be returned from the function int main) double widhI width of the rectangle entered by the user heightII height of the rectangle entered by the user area, perimeter, 1/ perimeter of the given rectangle diagonalI diagonal of the given rectangle Il area of the given rectangle Change the call to: o diagonal, perimeter, area he width cout > width; cout > height; : Run your program. What is output by the program for each result? : Why will this strategy never work for this function? : Undo the above changes made in the program. compute rectangle (width, height); cout

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!