Question: In C++: Write a program that computes the total cost for the number of cell phones bought at a store. Define two variables, numofCellPhones and
In C++:
Write a program that computes the total cost for the number of cell phones bought at a store. Define two variables, numofCellPhones and costPerCellPhone inside the main function and initialize them to zero. Now, define a new function ReadUserInput that takes these two variables as reference parameters and asks the users to enter non-zero positive values (input validation) for them. Finally, back in main function compute the total cost of the cell phone purchase and print it on the console.
You MUST use references
Example (do not print lines surrounded by ****):
****INSIDE Main, Calling ReadUserInput****
****INSIDE ReadUserInput****
How many cell phones did you buy? 7
What is the cost of each cell phone? 900
**** INSIDE MAIN ****
You bought 7 cell phones at $900 each, and the total cost is = $6300
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
