Exercise 6: Account Balance

In this exercise, you will be required to use pointers and pointer to functions to update the balance in an account

Part 1

Pointers to Update Account Balance

Problem Statement

In this part you are required to:

  • Make functions
    • Withdraw:
      • Is a void function.
      • Takes two parameters:
        • a pointer to the balance in account.
        • the amount to be withdrawn from account, also of type double.
      • Add a check so that the amount is only withdrawn if it is less then total balance in the account. Otherwise it should display: “You are broke. You don’t have enough money. Go away”
    • Deposit:
      • Takes two parameters:
        • a pointer to the balance in account.
        • the amount to be deposited in the account, also of type double.
      • The function should add the required amount into the account.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy