Solution: Save and Load Balance

This program simulates a simple banking system that saves and retrieves your balance using a text file.

Explanation:

  • It first tries to load the user’s balance from balance.txt; if not found, it starts with $100.

  • A menu allows the user to view balance, deposit money, withdraw money, or exit.

  • Deposits increase the balance, and withdrawals reduce it (only if sufficient funds are available).

  • When exiting, it saves the updated balance back to the file to preserve data for the next run.

  • The program ensures persistence — the balance remains stored even after closing and reopening it.

Solution: Save and Load Balance

This program simulates a simple banking system that saves and retrieves your balance using a text file.

Explanation:

  • It first tries to load the user’s balance from balance.txt; if not found, it starts with $100.

  • A menu allows the user to view balance, deposit money, withdraw money, or exit.

  • Deposits increase the balance, and withdrawals reduce it (only if sufficient funds are available).

  • When exiting, it saves the updated balance back to the file to preserve data for the next run.

  • The program ensures persistence — the balance remains stored even after closing and reopening it.