Question: In C++ Please Define a function ConvertToLiters() that takes two integer parameters as the number of gallons and pints. The function returns a double as
In C++ Please
Define a function ConvertToLiters() that takes two integer parameters as the number of gallons and pints. The function returns a double as the volume converted to liters, given that:
1 pint = 0.568261 liters
1 gallon = 8 pints
Ex: If the input is 2 15, then the output is:
Result: 17.6161 liters
#include
/* Your code goes here */
int main() { int userGallons; int userPints; cin >> userGallons; cin >> userPints; cout << "Result: " << ConvertToLiters(userGallons, userPints); cout << " liters" << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
