Simple ATM Machine Codding in C++
Simple ATM Machine Codding in C++:-
Here is a Simple ATM Machine Coding in c++(Automated teller machine).The code is written in c++ language. Dev is used to compile the code. The code carry out all the functions that all standard atm machines doINSTRUCTIONS:
PIN CODE is "1111"
TASKS:-
It performs following functions:-
1.To check Balance
2.To Withdraw
3.To Deposit
4.To Exit
CODING:-
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int main ()
{
system("color F0");
int deposit=0;
double amount=5000;
int withdraw= 0;
int choice=0;
int pin=0;
int keypin = 1111;
cout << "Enter your pin code: ";
cin >> pin;
if (pin==keypin)
{
cout << "\nyour Pin is Approved!\n";
cout << "\n\t====================================";
cout << "\n\n\n\t **** Welcome to ATM MACHINE ****";
cout << "\n\n\n\t====================================";
cout << "\n\n";
int balance=1;
int withdraw=2;
int deposit=3;
int Exit=4;
char c;
do{
cout << "\nEnter Number of your choice: "<<endl;
cout<<"1. To Check Balance "<<endl;
cout<<"2. To Withdraw "<<endl;
cout<<"3. To deposit "<<endl;
cout<<"4. To exit "<<endl;
cin >> choice;
if (choice==1)
{
cout <<"\nYour current balance is: \n" << amount<<endl;
cout<<"enter y if you want to continue.";
cin>>c;
}
else if (choice==2)
{
cout << "\nEnter the amount you want to withdraw: ";
cin >> withdraw;
if (withdraw>amount)
{
cout << "\nYou don't have sufficient balance.\n";
cout<<"enter y if you want to continue.";
cin>>c;
}
else
{
amount=amount-withdraw;
cout << "\nYour current balance is: \n" << amount;
cout<<"enter y if you want to continue.";
cin>>c;
}
}
else if (choice==3)
{
cout << "\nEnter the amount you want to deposit: ";
cin >> deposit;
amount=amount+deposit;
cout << "\nYour current balance is: \n" << amount;
cout<<"\nenter y if you want to continue.";
cin>>c;
}
else if (choice==4)
{
cout << "\nTHANK YOU! FOR BANKING WITH US......!!!!";
}
}while(c=='y');
} //if
else if (pin!=0)
{
cout << "\nInvalid pin!" << "\nPlease try again.";
}
return 0;
getch();
Comments
Post a Comment