logo CodeStepByStep logo

spending

Language/Type: C++ if/else input redundancy console input
Related Links:

The following code is poorly structured. Rewrite it so that it has a better structure and avoids redundancy. To help eliminate redundancy, convert the code into a function named spending that accepts as its parameter a string for a single person's name, and prints the appropriate information about that person's bills. Your function could be called twice (once for John and once for Jane) to replicate the original code's behavior.

Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.