63 152
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #58426 in C++ for syed

Question #58426
Write a function named liquid() that has an integer number parameter and
reference parameters named gallons, quarts, pints, and cups. The passed integer represents the total number of cups, and the function is to determine the numbers of gallons, quarts,
pints, and cups in the passed value. Using the reference parameters, the function should alter
the arguments in the calling function. Use these relationships: 2 cups = 1 pint, 4 cups = 1 quart,
and 16 cups = 1 gallon.
Expert's answer
#include "stdafx.h"
#include<iostream>
using namespace std;
void liquid(int cup, int*gallons, int*quarts,int*pint, int*cups);
int main()
{
int g, q, p, c;
int cup = 2;
liquid(cup, &g, &q, &p, &c);
cout << g << " " << q << " " << p<<" " << c;
cin >> c;
return 0;
}
void liquid(int cup, int*gallons, int*quarts,int*pint, int*cups)
{
*gallons = 16 * cup;
*quarts = 4 * cup;
*pint = 2 * cup;
*cups = cup;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions