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
icon
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning