Atm Simulator using C++

Atm Simulator using C++ (With source Code)

Atm Simulator using C++ (With source Code)

Hello, coders. Welcome to the codewithrandom blog. In this article, we will learn how to create an Atm Simulator using C++ (With Source Code).

An ATM Simulator is a console based software based on the notion of handling cash transactions for a personal account. The user may handle financial transactions like as withdrawals, deposits, and balance inquiries. This ATM Simulator is a scaled-down version of a genuine ATM. This project has been written in C++ programming language.

Airline Ticketing System using C++ (With Source Code)

What can an ATM simluator do?

In terms of the system’s characteristics, the user can withdraw the amount. The user must input the withdrew amount, and the system will provide a withdrawal receipt with the transactions and amount. The user only needs to input a sum in the deposit field, and the money entered will be deposited. Another function is balance inquiry, which allows the user to see his or her total remaining balance.

In general, the ATM simulators may be used to withdraw or deposit money, as well as to obtain account information such as the balance amount, etc. They are straightforward and simple to use, allowing users to conduct rapid self-service transactions.

Overview of the UI:

  • The welcome screen –
Please INSERT your Card [Press ENTER to insert card]
  • The logo is displayed – 
************** WELCOME TO ***************
  • After loading when the main menu for transaction is displayed – 
MAIN MENU TRANSACTION
[ 1 ] Withdrawal
[ 2 ] Deposit
[ 3 ] Check Balance
[ 4 ] Funds Transfer
[ 5 ] Exit ATM
    _____________________________________________
          Enter your choice: “

The user will choose an option to perform the operation of their choice. User will then enter a values according to the prompts that will be displayed on the console to perform that operation.

Atm Simulator using C++Source code:

You can directly use this code by copying it in your IDE to understand the working and then can create it by understanding the project.

#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <string>
#include <conio.h>
#include <time.h>
#include <string.h>
using namespace std;

void showMenu();
int mainMenuSelection(int);
void welcomeScreen();
void receipt();
void showLogo();
double enterAmountScreen(double);

void waiting(unsigned int mseconds)
    {
        clock_t goal = mseconds + clock();
        while (goal > clock());
    }
    
int main()
{
int choice, account;
string pin = "";
char ast;

    cout << fixed << showpoint << setprecision(2);

    welcomeScreen();
    
    system("cls");
    showLogo();
    cout << "\n\n\t\t\t  Please type your Bank Account Number : ";
    cin >> account;
    cout << "\n\t\t\t  Please type Personal Identification Number(PIN) : ";
    ast = _getch();
    //cin >> pin;
    
    while(ast!=13)
    {
      pin.push_back(ast);
      cout << '*';
      ast = _getch();

    }
 if (account!=221215 && pin!="221215")
 {
 	cout << "\n\t\t\tInvalid Bank Account and PIN. Please try again!"<<endl;
    getch();
 	
 }	
 else
  {
    //Create a do\while loop
    do
        {
            //Display the menu and get the user's choice.
            showMenu();
            cin >> choice;
            //Validate the menu selection.
            while (choice < 1 || choice > 5)
            {
                cout << "\n\t\t\tPlease enter your choice 1, 2, 3, 4, or 5: ";
                cin >> choice;
            }
            //Function to choose in the main menu selection1353
            
        int withdrawChoice, depositChoice;
        int checkBalanceChoice, fundsTransferChoice;
        double money = 0.0;
        char conf;
            if (choice==1)
            {			
                    system("cls");
                    showLogo();
                    cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 WITHDRAWAL TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                    cout << "\n\n\t\t\t [ 1 ] From Checking" << endl;
                    cout << "\t\t\t [ 2 ] From Savings" << endl;
                    cout << "\t\t\t [ 3 ] Quick Cash" << endl;
                    cout << "\t\t\t [ 4 ] Back to Main Menu" << endl;
                    cout << "\t\t\t _____________________________________________"<<endl;
                    cout << "\t\t\t Enter your withdraw transaction: ";
                    cin >> withdrawChoice;
                        while (withdrawChoice <1 || withdrawChoice >4 )
                            {
                                system("cls");
                                showLogo();
                                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 WITHDRAWAL TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                                cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2, 3 or 4 :  ";
                                cin >> withdrawChoice;
                            }
                        if (withdrawChoice == 4)
                        {
                            showMenu();
                        }
                        //Quick Cash
                        else if (withdrawChoice == 3) 
                        {
                            //fn1353
                            int amount1;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 QUICK CASH TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t REMAINING BALANCE : Php 10000"<<endl;
                            cout << "\n\t\t\t Enter the Amount (Php) : ";
                            cin >> amount1;
                            cout << "\n\t\t\t Your remaining quick cash balance: Php "<<10000 - amount1<<endl;
                            waiting(3000);
                            receipt();
                        cout << "\n\t\t\t|TRANSACTION:\t\t    QUICK WITHDRAWAL  |"
                         	 << "\n\t\t\t|AMOUNT:\t\t    "<<amount1<<".00\t      |"
                         	 << "\n\t\t\t|CURRENT BAL:\t\t    "<<20000 - amount1<<".00\t      |"
                             << "\n\t\t\t|AVAILABLE BAL:\t\t    "<<20000 - amount1<<".00\t      |"
                             << "\n\t\t\t|\t\t\t\t\t      |\n\t\t\t|HUWAG IPAALAM ANG PIN SA IBA.\t\t      |"
                             << "\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";
                            waiting(10000);
                            showMenu();
                        }
                        else if (withdrawChoice == 2)
                        {
                            int amount2;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CASH SAVINGS TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t AVAILABLE BALANCE : Php 10000" << endl;
                            cout << "\t\t\t Enter the amount : ";
                            cin >> amount2;
                            cout << "\t\t\t Your remaining savings balance: Php "<<10000 - amount2<<endl;
                            waiting(5000);
                            system("cls");
                            receipt();
                        cout << "\n\t\t\t|TRANSACTION:\t\t    SAVINGS WITHDRAWAL|"
                         	 << "\n\t\t\t|AMOUNT:\t\t    "<<amount2<<".00\t      |"
                         	 << "\n\t\t\t|CURRENT BAL:\t\t    "<<20000 - amount2<<".00\t      |"
                             << "\n\t\t\t|AVAILABLE BAL:\t\t    "<<20000 - amount2<<".00\t      |"
                             << "\n\t\t\t|\t\t\t\t\t      |\n\t\t\t|HUWAG IPAALAM ANG PIN SA IBA.\t\t      |"
                             << "\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";
                            waiting(10000);
                            //brought to you by code-projects.org
                            showMenu();
                        }
                        else if (withdrawChoice == 1)
                        {
                            int amount3;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CASH CHECKING TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t AVAILABLE BALANCE : Php 20000" << endl;
                            cout << "\t\t\t Enter the amount : ";
                            cin >> amount3;
                            cout << "\t\t\t Your remaining check balance: Php "<<20000 - amount3<<endl;
                            waiting(3000);
                            system("cls");
                            receipt();
                        cout << "\n\t\t\t|TRANSACTION:\t\t    CASH WITHDRAWAL   |"
                         	 << "\n\t\t\t|AMOUNT:\t\t    "<<amount3<<".00\t      |"
                         	 << "\n\t\t\t|CURRENT BAL:\t\t    "<<20000 - amount3<<".00\t      |"
                             << "\n\t\t\t|AVAILABLE BAL:\t\t    "<<20000 - amount3<<".00\t      |"
                             << "\n\t\t\t|\t\t\t\t\t      |\n\t\t\t|HUWAG IPAALAM ANG PIN SA IBA.\t\t      |"
                             << "\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";
                            waiting(10000);
                            showMenu();							
                        }
            }
            else if(choice==2)
            {
                        system("cls");
                        showLogo();
                        cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                        cout << "\n\n\t\t\t [ 1 ] To Checking" << endl;
                        cout << "\t\t\t [ 2 ] To Savings" << endl;
                        cout << "\t\t\t [ 3 ] Back to Main Menu" << endl;
                        cout << "\t\t\t _____________________________________________"<<endl;
                        cout << "\t\t\t Enter your deposit transaction: ";
                        cin >> depositChoice;
                        while (depositChoice < 1 || depositChoice > 3)
                            {
                                system("cls");
                                showLogo();
                                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                                cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2 or 3 :  ";
                                cin >> depositChoice;
                            }
                        if (depositChoice == 3)
                        {
                            showMenu();
                        }
                        else if (depositChoice == 2)
                        {
                            int depamount1;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 SAVINGS DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t Enter the deposit amount : Php ";
                            cin >> depamount1;
                            cout << "\t\t\t Your New Balance: Php "<<depamount1+10000<<endl;
                            waiting(5000);
                            system("cls");
                            showMenu();						
            
                        }
                        else if (depositChoice == 1)
                        {
                            int depamount2;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK DEPOSIT TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t Enter the deposit amount : Php ";
                            cin >> depamount2;
                            cout << "\t\t\t Your New Balance: Php "<<depamount2+20000<<endl;
                            waiting(5000);
                            system("cls");
                            showMenu();						
                        }					
            }
            else if (choice==3)
            {					
                        system("cls");
                        showLogo();
                        cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK BALANCE TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                        cout << "\n\n\t\t\t [ 1 ] From Checking" << endl;
                        cout << "\t\t\t [ 2 ] From Savings" << endl;
                        cout << "\t\t\t [ 3 ] Back to Main Menu" << endl;
                        cout << "\t\t\t _____________________________________________"<<endl;
                        cout << "\t\t\t Enter Your Check Balance Choice: ";
                        cin >> checkBalanceChoice;
                            while (checkBalanceChoice < 1 || checkBalanceChoice > 3)
                            {
                                system("cls");
                                showLogo();
                                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK BALANCE TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                                cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2 or 3 :  ";
                                cin >> checkBalanceChoice;
                            }
                        if (checkBalanceChoice == 3)
                        {
                            showMenu();
                        }
                        else if (checkBalanceChoice ==2)
                        {
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 BALANCE SAVINGS TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t NEW AVAILABLE BALANCE : Php 10000";
                            waiting(3000);
                            showMenu();
                        }
                        else if (checkBalanceChoice ==1)
                        {
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 BALANCE CHECK TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t NEW CHECK BALANCE : Php 20000";
                            waiting(3000);
                            showMenu();
                        }
            }
            else if (choice==4)
            {	
                        system("cls");
                        showLogo();
                        cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 FUND TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                        cout << "\n\n\t\t\t [ 1 ] Transfer from Savings to Checking" << endl;
                        cout << "\t\t\t [ 2 ] Transfer from Checking to Savings" << endl;
                        cout << "\t\t\t [ 3 ] Back to Main Menu" << endl;
                        cout << "\t\t\t _____________________________________________"<<endl;
                        cout << "\t\t\t Enter Your Funds Transfer Transaction: ";
                        cin >> fundsTransferChoice;
                        while (fundsTransferChoice < 1 || fundsTransferChoice > 3)
                            {
                                system("cls");
                                showLogo();
                                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 FUND TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                                cout << "\n\n\t\t\t Invalid Transaction!\n\t\t\t Please re-enter 1, 2 or 3 :  ";
                                cin >> fundsTransferChoice;
                            }
                        if (fundsTransferChoice == 3)
                        {
                            showMenu();
                        }
                        else if (fundsTransferChoice ==2)
                        {
                            int accntNo, checkNo, amntNo;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t NEW CHECK BALANCE : Php 20000";
                            cout << "\n\t\t\t Account Number (for Transfer) : ";
                            cin >> accntNo;
                            cout << "\n\t\t\t Check Number : ";
                            cin >> checkNo;
                            cout << "\n\t\t\t Amount Transfer : Php ";
                            cin >> amntNo;
                            while (amntNo < 2000 || amntNo > 20000)
                            {
                                system("cls");
                                showLogo();
                                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 CHECK TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                                cout << "\n\n\t\t\t Invalid Amount!\n\t\t\t Please try again!";
                                cout << "\n\t\t\t Please enter Amount Transfer : Php ";
                                cin >> amntNo;
                                
                            }
                            waiting(1000);
                            cout << "\n\n\t\t\t The amount of Php "<<amntNo<<" has been transfered to \n\t\t\t "<<accntNo<<" with a check # "<<checkNo<<endl;
                            waiting(10000);
                            showMenu();
                        }
                        else if (fundsTransferChoice ==1)
                        {
                            int accntNo, checkNo, amntNo;
                            system("cls");
                            showLogo();
                            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 SAVINGS TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                            cout << "\n\n\t\t\t NEW SAVINGS BALANCE : Php 10000";
                            cout << "\n\t\t\t Account Number (for Transfer) : ";
                            cin >> accntNo;
                            cout << "\n\t\t\t Amount Transfer : Php ";
                            cin >> amntNo;
                            while (amntNo < 2000 || amntNo > 10000)
                            {
                                system("cls");
                                showLogo();
                                cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 SAVINGS TRANSFER TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2";
                                cout << "\n\n\t\t\t Invalid Amount!\n\t\t\t Please try again!";
                                cout << "\n\t\t\t Please enter Amount Transfer : Php ";
                                cin >> amntNo;
                                
                            }
                            waiting(1000);
                            cout << "\n\n\t\t\t The amount of Php "<<amntNo<<" has been transfered to "<<accntNo;
                            waiting(10000);
                            showMenu();
                        }
            }		
            else if (choice ==5)
            {
                        cout << " \n\t\t\t Brought To You By code-projects.org" << endl << endl;
                        getch();
            }
        } while (choice != 5);
 }
        return 0;

}
    //Function to display the welcome screen
    void welcomeScreen()
    {
        cout<<"\n\t\t\t _____________________________________________"
            <<"\n\t\t\t|\t\t\t\t\t      |\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2  |"
            <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
            <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
            <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
            <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
            <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
            <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2  |"
            <<"\n\t\t\t|\t\t\t\t\t      |\n\t\t\t|=============== ATM SIMULATION ==============|";		
        cout << "\n\n\t\t\tPlease INSERT your Card [Press ENTER to insert card] ";
        cin.get();
    }

    void showLogo()
    {
            cout<<"\n\t\t\t + ************** WELCOME TO *************** + ";
            cout<<"\n\t\t\t _____________________________________________"
                <<"\n\t\t\t|\t\t\t\t\t      |\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2  |"
                <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
                <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
                <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
                <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
                <<"\n\t\t\t| \xB2\xB2\t     \xB2\xB2\t\xB2\xB2\t   \xB2\xB2\t\xB2\xB2\t   \xB2\xB2 |"
                <<"\n\t\t\t| \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2  |"
                <<"\n\t\t\t|\t\t\t\t\t      |\n\t\t\t|=============== ATM SIMULATION ==============|";		
    }

    void showMenu()
        {
            system("cls");
            showLogo();
            cout << endl <<" \t\t\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 MAIN MENU TRANSACTION \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2";
            cout << "\n\n\t\t\t [ 1 ] Withdrawal" << endl;
            cout << "\t\t\t [ 2 ] Deposit" << endl;
            cout << "\t\t\t [ 3 ] Check Balance" << endl;
            cout << "\t\t\t [ 4 ] Funds Transfer" << endl;
            cout << "\t\t\t [ 5 ] Exit ATM" << endl;
            cout << "\t\t\t _____________________________________________"<<endl;
            cout << "\t\t\t Enter your choice: ";
        }
    
    void receipt()
    {
            system("cls");
            showLogo();
            char date[9];
            char time[9];
            _strdate(date);
            _strtime(time);
            cout << "\n\n\t\t\t\t\t PRINTING RECEIPT . . .\n";
            waiting(3000);
            system("cls");
            showLogo();
            cout << endl <<"\n\n\t\t\t|\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 BANCO DE ORO \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2|";
            cout << "\n\t\t\t|\t\t\t\t\t      |"
                 << "\n\t\t\t|\t     ATM TRANSACTION RECORD\t      |"
                 << "\n\t\t\t|\t\t\t\t\t      |"
                 << "\n\t\t\t|DATE:\t\t\t    "<<date<<"\t      |"
                 << "\n\t\t\t|TIME:\t\t\t    "<<time<<"\t      |"
                 << "\n\t\t\t|LOCATION:\t\t    MASBATE \t      |"
                 << "\n\t\t\t|CARD NUM:\t\t    ************1215  |";
    }
            
        //Function to enter amount screen
        double enterAmountScreen(double money)
        {
            system("cls");
            int decision;
                cout << endl << "\t\tEnter Amount Screen" << endl;
                cout << "[ 1 ] Enter Amount:";
                cout << endl << "[ 2 ] Back to Main Menu:";
                cout << endl << "Enter your decision for the amount screen: ";
                cin >> decision;
                if (decision == 2)
                    {
                        showMenu();
                    }
                else
                    {
                        cout << "Please enter the amount: ";
                        cin >> money;
                    }
            return money;
        }

Now let us understand the code:-

  • We will start by writing the header of the code with the required libraries – iostream  (input and output stream), iomanip (formatting), stdlib.h (memory management), string.h (string manipulation), conio.h (console input/output), time.h (time management).
  • Now we will declare some functions which will be used to give logic to the project – void showMenu(); int mainMenuSelection(int); void welcomeScreen(); void receipt(); void showLogo(); double enterAmountScreen(double);.
  • The main() function consists of the function calls depending upon how the user operates the simulator. We will initialize some variables in the main() function. It will start off by displaying the welcome screen and the will prompt the user to type their bank account number and Personal Identification Number(PIN) for authentication.
  • The program then checks to see if the account number and PIN entered match the predefined settings. If the values do not match, an error notice is displayed and the user is prompted to try again. If the values are the same, the program will show the main menu and asks the user to choose an option.
  • We will create a do\while loop which will first display the menu and get the user’s choice, the it will validate the menu selection. Now we will declare functions to choose in the main menu selection. We will use if-else control statements to select between the options.
  • The following options will be displayed to the user to select from:
    1. Withdrawal
    2. Deposit
    3. Check Balance
    4. Funds Transfer
    5. Exit ATM
  • Upon selecting from the above operations, the program will run accordingly.
  • Choosing option 1 – The program will present a menu prompting the user to pick the account from which they wish to withdraw funds. The customer can choose between a checking and a savings account. The user is next prompted to input the amount of cash to be withdrawn. If the amount is correct, the program deducts it from the user’s account balance and displays a receipt on the screen.
  • Choosing option 2 – The program will present a menu asking the user to pick the account into which they wish to deposit money. The customer can choose between a checking and a savings account. The program then asks the user to input the amount of money to deposit. If the amount is correct, the program adds it to the user’s account balance and displays a receipt on the screen.
  • Choosing option 3 – The program will check the user’s account balance and the display the account balance to the user.
  • Choosing option 4 – The user will be asked to input the account number to which they wish to transfer funds. The user is next asked to input the amount of money to be transmitted. If the amount is correct, the program will subtract it from the user’s account balance and add it to the given account balance. After that, the program produces a receipt to the screen.
  • Choosing option 5 – The program will exit.
  • The welcomeScreen() function will displays a welcome screen to the user. It will ask the user – “Please INSERT your Card [Press ENTER to insert card]”.
  • The showLogo() function will display the logo of the bank.
  • The showMenu() function will display the main menu and then ask the user to choose from the many options available on the menu.
  • The receipt() function will print a receipt of the items purchased by user on the screen console.
  • The enterAmountScreen() function asks the user to enter the amount of cash to be withdrawn or transferred.

Chess Game Using C++ (With Source Code)

Final Output:-

Here is an example to show how this project works.

Atm Simulator using C++

Enter account number-221215 and pin – 221215.

Atm Simulator using C++

Main Menu is displayed

Atm Simulator using C++

Selection option 1 – Withdrawal

Atm Simulator using C++

From withdrawal transaction, selecting option 1 – From Checking

Atm Simulator using C++

Conclusion

We have reached the end of this article and have a lot more projects in C++ coming so stay tuned. We have started with awesome and fun projects for you all to understand C++. Learning C++ by creating fun projects makes learning easy and interesting.

Canteen Management System using C++ (With Source Code)

If you enjoyed the article and learned something new today, let us know in the comments.

Thank you.

Happy Reading! 🙂

ADVERTISEMENT

Follow: CodeWithRandom

ADVERTISEMENT



Leave a Reply