Complete Question:
Using C++
Complete the function definition to output the hours given minutes. Output for sample program:
3.5
Given Code
#include <iostream>
using namespace std;
void OutputMinutesAsHours(double origMinutes) {
/* Your solution goes here */
}
int main() {
OutputMinutesAsHours(210.0); // Will be run with 210.0, 3600.0, and 0.0.
cout << endl;
return 0;
}
Answer:
#include <iostream>
using namespace std;
void outputminutesashours(double origminutes) {
double outputminutesashours=origminutes/60;
cout<<"The converted to hours is "<<outputminutesashours<<" hours"<<endl;
}
int main() {
double minutes;
cout<<"Enter The Minutes"<<endl;
cin >> minutes;
outputminutesashours(minutes); // will be run with 210.0, 3600.0, and 0.0.
cout << endl;
return 0;
}
Explanation:
The addiditional line of code to make this program work is written in bold
Sample run with 210 gives 3.5 hours
Sample run with 3600 gives 60 hours, and 0.0 gives 0