Simulation of Cryptocurrency Transactions Gaming Project in C++

Explanation:

  1. User Class:
    • Represents a user with a name and balance.
    • deposit(double amount): Adds the specified amount to the user’s balance if it is positive.
    • withdraw(double amount): Subtracts the specified amount from the user’s balance if it is positive and less than or equal to the current balance.
    • getBalance(): Returns the current balance of the user.
  2. CryptocurrencySystem Class:
    • Manages multiple users using an unordered map (std::unordered_map).
    • addUser(const std::string& name): Adds a new user to the system if they do not already exist.
    • deposit(const std::string& name, double amount): Calls the deposit method of the User class for the specified user.
    • withdraw(const std::string& name, double amount): Calls the withdraw method of the User class for the specified user.
    • checkBalance(const std::string& name): Displays the balance of the specified user.
  3. main Function:
    • Demonstrates adding users, performing deposits and withdrawals, and checking balances.

      Compilation:

      To compile the program, use:

      Run the program with:
       

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top