Write a function that converts an input of some integer number of ounces into ou
ID: 3635825 • Letter: W
Question
Write a function that converts an input of some integer number of ounces into outputs of integer numbers of quarts, pints, and ounces. Do not write a main function. Your function does not do cin or cout. Your function will have four parameters. Make sure you use appropriate parameter passing techniques! Your function will be a void function. There are 16 ounces in a pint, and 32 ounces in a quart. For example, if the total number of ounces input is 50, the results are 1 quart, 1 pint, and 2 ounces.Explanation / Answer
void function(int q,int p,int o,int total_ounces) { q=(total_ounces/32); o=total_ounces-(32*q); total_ounces=o; p=(total_ounces/16); o=total_ounces-(16*p); total_ounces=o; }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.