Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 . Make the following changes to the program so that the values will be returned from the function. Change the return type for the
Make the following changes to the program so that the values will be returned from the function.
Change the return type for the computerectangle function from void to double both in prototype and definition header
Change the call to:
o diagonal, perimeter, area computerectangle height width;
Add a return at the end of the computerectangle function
o return diagonal, perimeter, area;
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.
Add call by reference parameters to send back the values of area, perimeter and diagonal to main. Change the prototype, function call and function definition to get the program to compile and run correctly.
Should the height and width parameters be call by value or call by reference? Explain your answer.
Change all instances of the variable perimeter to p in the computerectangle function including the prototype and header line Run your program. What does this tell you about the agreement of names of call by reference parameters in main and in the function?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started