Você está na página 1de 13

/* Date Name

:5-11-2011 :Anurag Garg

RegNo. :11011526 Roll no :RK3007B33 compiler :Dev-C++ 4.9.9.2

*/ #include<iostream> #include<conio.h> #include<fstream> using namespace std; class details { private:

unsigned long int pin; char name[20]; unsigned int choice; public: double balance; details() { ofstream outf("username.txt"); // outf.close(); if(!outf)// if file could not be open the file for writing { cerr<<"Sorry for the inconvineance\nSystem is temporary down"<<endl; exit(1);

} cout<<"Welcome to World Bank \nInsert your Card in ATM machine\n"<<"Hello,Please enter your user name:\t\t\tProgramed by:Anurag Garg"<<endl; cin>>name; outf<<name<<endl; cout<<endl<<"Hello,"<<name<<endl<<"Please enter your pin number\n"; cin>>pin; outf<<pin;

} };

class accounts:public details { private: unsigned int choice,acType,checkReciept,fastCash,fastChoice; float amount,balance; public:

accounts() { got://goto statement will take you here //balance; int ye; cout<<"Enter the amount you want to deposite\n"; cin>>balance; cout<<balance;

cout<<"\nEnter Your Choice:\n1 for Balance Enquiry\n2 for FastCash\n"; cout<<"3 for MiniStatement\n4 for Cash Withdrawal"<<endl; cin>>choice; cout<<"\nYour entered choice is:"<<choice; switch(choice) { case 1://For Balance inquiry { cout<<"\nYour account balance is :"<<balance<<endl; cout<<"Do you want to continue...\nPress\n1 for Yes\n0 for No"<<endl; cin>>ye; if(ye==1) { goto got; } else { break; } } case 2://for fast cash { cout<<"\nAccount Type:\n1 for saving\n2 for current\n"; cin>>acType; cout<<"\nDo you want a printed reciept\n0 for No\n1 for Yes\n"<<endl; cin>>checkReciept;

if(acType==1) { cout<<"\nEnter your choice\n1 for 1000\n2 for 500\n3for 100\n"; cin>>fastChoice; switch(fastChoice) { case 1:// 1000 Rs. note { if(balance>1000) {

cout<<endl<<"Enter the no of NOTE of 1000\n"; cin>>fastCash; fastCash=fastCash*1000; if(fastCash<(int)balance) { balance=balance-fastCash; cout<<"Collect the cash\nCollect the reciept\n"; cout<<"Avilable Balance\n"<<balance; } else { cout<<"\ninsufficient Amount"<<endl; } cout<<"avilable Balance:"<<balance; cout<<"\nDo you want to continue...\nPress\n1 for Yes\n0 for No";

cin>>ye; if(ye==1) { goto got; } break; } } case 2:// 500 Rs. note { if(balance>500) {

cout<<endl<<"Enter the no of NOTE of 500\n"; cin>>fastCash; fastCash=fastCash*500; if(fastCash<(int)balance) { balance=balance-fastCash; cout<<"Collect the cash\n...\n..\n.\nCollect the reciept"; cout<<"Avilable Balance"<<balance; } else { cout<<"\ninsufficient Amount"<<endl; } cout<<"avilable Balance:"<<balance;

cout<<"Do you want to continue...\nPress\n1 for Yes\n0 for No"; cin>>ye; if(ye==1) { goto got; } break; } } case 3:// 100 Rs. note { if(balance>100) {

cout<<endl<<"Enter the no of NOTE of 100\n"; cin>>fastCash; fastCash=fastCash*100; if(fastCash<(int)balance) { balance=balance-fastCash; cout<<"Collect the cash\n...\n..\n.\nCollect the reciept"; cout<<"Avilable Balance"<<balance; } else { cout<<"\ninsufficient Amount"<<endl; }

cout<<"\navilable Balance:"<<balance; cout<<"\nDo you want to continue...\nPress\n1 for Yes\n0 for No"; cin>>ye; if(ye==1) { goto got; } break; } } }//switch ends here

} if(acType==2) { cout<<"\nEnter your choice\n1 for 1000\n2 for 500\n3for 100\n"; cin>>fastChoice; switch(fastChoice) { case 1:// 1000 Rs. note { if(balance>1000) {

cout<<endl<<"Enter the no of NOTE of 1000\n"; cin>>fastCash;

fastCash=fastCash*1000; if(fastCash<(int)balance) { balance=balance-fastCash; cout<<"\nCollect the cash\nCollect the reciept"; cout<<"\nAvilable Balance"<<balance; } else { cout<<"\ninsufficient Amount"<<endl; } cout<<"\navilable Balance:"<<balance; cout<<"\nDo you want to continue...\nPress\n1 for Yes\n0 for No"; cin>>ye; if(ye==1) { goto got; } break; } } case 2:// 500 Rs. note { if(balance>500) {

cout<<endl<<"\nEnter the no of NOTE of 500\n"; cin>>fastCash; fastCash=fastCash*500; if(fastCash<(int)balance) { balance=balance-fastCash; cout<<"\nCollect the cash\nCollect the reciept"; cout<<"\nAvilable Balance"<<balance; } else { cout<<"\ninsufficient Amount"<<endl; } cout<<"\navilable Balance:"<<balance; cout<<"\nDo you want to continue...\nPress\n1 for Yes\n0 for No"; cin>>ye; if(ye==1) { goto got; } break; } } case 3:// 100 Rs. note { if(balance>100)

cout<<endl<<"\nEnter the no of NOTE of 100\n"; cin>>fastCash; fastCash=fastCash*100; if(fastCash<(int)balance) { balance=balance-fastCash; cout<<"\nCollect the cash\nCollect the reciept"; cout<<"\nAvilable Balance"<<balance; } else { cout<<"\ninsufficient Amount"<<endl; } cout<<"\navilable Balance:"<<balance; cout<<"\nDo you want to continue...\nPress\n1 for Yes\n0 for No"; cin>>ye; if(ye==1) { goto got; } break; } } }//switch ends here

case 3://mini statement { cout<<"\nTake your Receipt\nHave a nice Day!!!\n"; break; } case 4://Cash withdrawal { cout<<"\nAccount Type:\n1 for saving\n2for current\n"; cin>>acType; cout<<"\nDo you want a printed reciept\n0 for No\n1 for Yes\n"<<endl; cin>>checkReciept; if(acType==1) { if(balance>amount) { cout<<"\nEnter amount:\n(In the multiple of 100)\n"; cin>>amount; balance=balance-amount; } else { cout<<"\nInsufficient balance\n"; } cout<<"\nAvilable Balance=:"<<balance<<endl; if(checkReciept=1)

{ cout<<"\nTake your Receipt\nHave a nice Day!!!"; } } if(acType==2) { if(balance>100) { cout<<"\nEnter amount:\n(In the multiple of 100)\n"; cin>>amount; balance=balance-amount; } else { cout<<"\nINSUFFICIENT BALANCE\n"; } cout<<"\nAvilable Balance=:"<<balance<<endl; if(checkReciept=1) { cout<<"\nTake your Receipt\nHave a nice Day!!!\n"; } } break; } default: {

cout<<"\nWrong Choice Entered :)\nplease try again"<<endl;

} } } } }; int main() {

accounts acc;//constructor will call every function getch(); return 0; } //end of program

Você também pode gostar