Header Ads

ATM Bank Accounts Program Using Structure in C++


ATM Bank Accounts Program Using Structure in C++

An Automatic Teller Machine (ATM) is used by the Customers of a Bank. Each Customer has an Account Number Customer Name, PIN Number.


ATM, Program, Structure, C++,Assignment,Bank, Accounts, Program,Transaction,File Handling, Machine, Check Balance,Deposit Amount,Withdraw Amount,Transfer Amount,Show History,ATM C++ Assignment

  • Check Balance
  • Deposit Amount
  • Withdraw Amount
  • Transfer Amount
  • Show History


C++ Program to Display The ATM Transaction

C++ Code




#include<iostream>

using namespace std;

struct ATM{

int accNo,pin;

long int banlanec = 1000, withdraw,diposit, transfer;

char name[20];

};
main(){
char choice;
int t;
ATM s;
cout<<"Enter Pin Code:";
cin>>s.pin;
while(s.pin != 1234){
cout<<"Enter your Secrt pin code:";
cin>>s.pin;
}
do{
               cout<<"----Welcome to ATM Main Menu----"<<endl;
cout<<"1.Check Balance"<<endl;
cout<<"2.Withdraw Cash"<<endl;
cout<<"3.Deposite Cash"<<endl;
cout<<"4.Transfer Cash"<<endl;
cout<<"5.Quit"<<endl;
cout<<"-----------------------------"<<endl;
cout<<"Enter Choice:";
cin>>t;
switch(t){
case 1:
cout<<"Your Balance is :"<<s.banlanec<<endl;
break;
case 2:
cout<<"Enter Amount to With Draw:";
cin>>s.withdraw;
if(s.withdraw%500 != 0){
cout<<"Plz Enter Correct Amount:";
cin>>s.withdraw;
if(s.withdraw%500 != 0){
cout<<"Plz Enter Correct Amount:";
    cin>>s.withdraw;
}
else if(s.withdraw>s.banlanec){
cout<<"Insufficent Balance"<<endl;
}
else{
s.banlanec =s.banlanec - s.withdraw;
}
}
else if(s.withdraw>s.banlanec){
cout<<"Insufficent Balance"<<endl;
}
else{
s.banlanec= s.banlanec -s.withdraw;
}
break;
case 3:
cout<<"Enter Amount to Deposite:";
cin>>s.diposit;
s.banlanec = s.banlanec + s.diposit;
cout<<"Your Balance is:"<<s.banlanec<<endl;
break;
case 4:
cout<<"Enter Acount Number to Transfer Money";
case 5:
cout<<"Thanks for Using ATM"<<endl;
break;
}
cout<<"Do You want to Another Transaction:";
cin>>choice;
}while(choice=='y'|| choice=='Y');
}


No comments

Powered by Blogger.