Problem on c+ programming


Assignment:

Write a program that includes a function PICNIC() that will accept a floating-point number TOTAL and the addresses of the interger variables HOTDOGS, HAMBURGERS,SALAD,PICKLES. The passed floating-point number represents the TOTAL amount of money to be spent on food. The function is to determine the quantity of HOTDOGS, HAMBURGERS,SALAD,PICKLES that can be purchaced, writing these values directly into the respective variables declared in the calling function.

This function will be called from the main program and when it returns to main, it will print out the values of HOTDOGS, HAMBURGERS,SALAD,PICKLES.
Our favorite foods are in this order:
1- hotdogs 1.00$ each
2- hamburgers .50$ each
3- salad .25$ each
4- pickles .01$ each

Example: if I enter the total amount of money of 3.78$, i can bring the following items to my picnic: 3 hotdogs, 1 hamburger, 1 salad, 3 pickles.

Provide complete and step by step solution for the question and show calculations and use formulas.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Problem on c+ programming
Reference No:- TGS01926515

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)