Dashboard Temp Share Shortlinks Frames API

HTMLify

yacefkwqz2.cpp
Views: 135 | Author: guest
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include <iostream>

using namespace std;

int new_transaction;

// Initialising the balance amount as 0.

float balance_amount = 0.0;

// Function for operations in ATM Machine1

void atm_machine_transaction() {

    cout << "Choices Available in the ATM Machine" << endl;

    cout << "1. Deposit Money" << endl;

    cout << "2. Withdraw Money" << endl;

    cout << "3. Balance Amount" << endl;

    cout << "\n";

    /*

        Take an appropriate option to select which operation

        you want to be performed by the ATM Machine.

    */

    int option;

    cout << "Your option: ";

    cin >> option;

    float withdraw_amount;

    float deposit_amount;

    switch(option)

    {

        // Case for Depositing money

        case 1:

            cout << "\nEnter the amount to deposit: ";

            cin >> deposit_amount;

            balance_amount += deposit_amount;

            cout << "Your current balance is Rs. " << balance_amount << ". Thanks for depositing!" << endl;

            cout << "Do you want a new transaction?\nPress 1 to 'proceed' and 2 to 'exit' from here\n" << endl;

            cout << "Your option: ";

            cin >> new_transaction;

            if (new_transaction == 1)
	{

           	     atm_machine_transaction();

            }

        break;

         // Case for Money Withdrawal

        case 2:

            cout << "\nPlease enter amount to withdraw: ";

            cin >> withdraw_amount;

            if (withdraw_amount > balance_amount)

            {

                cout << "Insufficient fund! Please proceed to deposit money." << endl;

                cout << "Do you want a new transaction?\nPress 1 to 'proceed' and 2 to 'exit' from here\n" << endl;

                cout << "Your option: ";

                cin >> new_transaction;

                if (new_transaction == 1)
	{

                    atm_machine_transaction();

                }

            }

            else

            {

                balance_amount -= withdraw_amount;

                cout << "You have withdrawn Rs. " << withdraw_amount << " and your balance is Rs. " << balance_amount << endl;

                cout << "Do you want a new transaction?\nPress 1 to 'proceed' and 2 to 'exit' from here\n" << endl;

                cout << "Your option: ";

                cin >> new_transaction;

                if (new_transaction == 1)
	{
                    atm_machine_transaction();

                }

            }

        break;

   
        // Case for checking current bank amount

        case 3:

            cout << "Your current bank balance is: " << balance_amount << endl;

            cout << "Do you want a new transaction?\nPress 1 to 'proceed' and 2 to 'exit' from here\n" << endl;

            cout << "Your option: ";

            cin >> new_transaction;

            if (new_transaction == 1)
	{

                atm_machine_transaction();

            }

        break;

    }

}
int main()

{

    atm_machine_transaction();

    cout << "Thank you for the visit!";
    return 0;

}