4 Functions with Reference Parameters Use program MPH for Exercises 5. Program MPH reads two real numbers, miles and hours, and prints milesPerHour on the screen. Function GetData prompts the user for the appropriate values, reads them, and returns them to function main as reference parameters. // Program MPH reads miles and hours and prints miles // per hour. #include #include using namespace std; /* FILL IN the function prototype for GetData */ int main () float miles; float hours; float milesPerHour; cout << fixed << showpoint; /* FILL IN code to invoke function GetData */ milesPerHour = miles / hours; cout << setw(10) << miles << setw (10) << hours << setw (10) < milesPerHour << endl; return 0; /* FILL IN the function heading for GetData */ /* FILL IN code to prompt for miles and hours */ /* FILL IN code to read miles and hours */ Exercise 5. Fill in the missing code and compile and run your program three times using the following values and record the results. Miles Hours Miles per Hour 120.1 332.0 1250.0 2.2 5.5 20.0
4 Functions with Reference Parameters Use program MPH for Exercises 5. Program MPH reads two real numbers, miles and hours, and prints milesPerHour on the screen. Function GetData prompts the user for the appropriate values, reads them, and returns them to function main as reference parameters. // Program MPH reads miles and hours and prints miles // per hour. #include #include using namespace std; /* FILL IN the function prototype for GetData */ int main () float miles; float hours; float milesPerHour; cout << fixed << showpoint; /* FILL IN code to invoke function GetData */ milesPerHour = miles / hours; cout << setw(10) << miles << setw (10) << hours << setw (10) < milesPerHour << endl; return 0; /* FILL IN the function heading for GetData */ /* FILL IN code to prompt for miles and hours */ /* FILL IN code to read miles and hours */ Exercise 5. Fill in the missing code and compile and run your program three times using the following values and record the results. Miles Hours Miles per Hour 120.1 332.0 1250.0 2.2 5.5 20.0
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 20PE
Related questions
Question
Can anyone help me these coding questions
![4 Functions with Reference Parameters
Use program MPH for Exercises 5. Program MPH reads two real numbers, miles and hours, and prints
milesPerHour on the screen. Function GetData prompts the user for the appropriate values, reads them,
and returns them to function main as reference parameters.
// Program MPH reads miles and hours and prints miles
// per hour.
#include <iostream>
#include <iomanip>
using namespace std;
/* FILL IN the function prototype for GetData */
int main ()
{
float miles;
float hours;
float milesPerHour;
cout << fixed << showpoint;
/* FILL IN code to invoke function GetData */
milesPerHour = miles / hours;
cout << setw(10) << miles
<« setw(10) << hours
<< setw (10) <« milesPerHour << endl;
return 0;
/* FILL IN the function heading for GetData */
{
/* FILL IN code to prompt for miles and hours */
/* FILL IN code to read miles and hours */
}
Exercise 5.
Fill in the missing code and compile and run your program three times using the following values and
record the results.
Miles
120.1
332.0
Hours
Miles per Hour
2.2
5.5
1250.0
20.0](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3f6c81c7-9a41-4014-8916-60df888d5014%2Fd5aed7a8-fdcb-42f1-9f2c-72bc01b12311%2Fl52253_processed.jpeg&w=3840&q=75)
Transcribed Image Text:4 Functions with Reference Parameters
Use program MPH for Exercises 5. Program MPH reads two real numbers, miles and hours, and prints
milesPerHour on the screen. Function GetData prompts the user for the appropriate values, reads them,
and returns them to function main as reference parameters.
// Program MPH reads miles and hours and prints miles
// per hour.
#include <iostream>
#include <iomanip>
using namespace std;
/* FILL IN the function prototype for GetData */
int main ()
{
float miles;
float hours;
float milesPerHour;
cout << fixed << showpoint;
/* FILL IN code to invoke function GetData */
milesPerHour = miles / hours;
cout << setw(10) << miles
<« setw(10) << hours
<< setw (10) <« milesPerHour << endl;
return 0;
/* FILL IN the function heading for GetData */
{
/* FILL IN code to prompt for miles and hours */
/* FILL IN code to read miles and hours */
}
Exercise 5.
Fill in the missing code and compile and run your program three times using the following values and
record the results.
Miles
120.1
332.0
Hours
Miles per Hour
2.2
5.5
1250.0
20.0
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning