.ZIP

# Program to ask two people for their account balance

Write a program to ask two people for their account balance. Then, based on who has the most money, all subsequent purchases will be charged to his or her account.

Example

User input is underlined:

What is Sam's balance? 229.12
What is Sue's balance? 241.45
Cost of the date:
Dinner: 32.19
Movie: 14.50
Ice cream: 6.00
Sam's balance: \$229.12
Sue's balance: \$188.76

Note that there is a tab before "Dinner," "Movie," and "Ice cream." There are spaces after the colons.

Challenge

As a challenge, try to write a function to reduce the value of the debit card according to the cost of the date:

void date(float *pAccount);

This function will contain the three prompts (Dinner, Movie, and Ice Cream) and reduce the value of pAccount by that amount.

Write the program to store the two account balances. Create a pointer to the account that has the largest balance. Then, for the three item costs on the date, reduce the balance of the appropriate account using the pointer.