Wednesday, February 13, 2013

Project on ATM machine working in CPP

/*program of ATM machine working....*/

#include<string.h>
#include<iostream.h>
#include<conio.h>
class Atm               //classname......//
{
int choice,i;
float b,c;
char str[7];
public:
void get();              //function declaration.....//
};
void Atm::get()
{
cout<<"\tEnter Your Password: ";         //ATM  password(ABCDE)...//
for(i=0;i<=4;i++)
{
str[i]=getch();
cout<<"*";
}
str[i]='\0';
if(strcmp(str,"ABCDE")==0)
{
float a=30000;                         //ATM's front page....//
cout<<endl<<endl<<"\t** WELCOME TO SBI **"<<endl<<endl;
cout<<" \tHello Mr.Chinmay Mahajan\t"<<endl<<endl<<endl;
cout<<"\t1.Information.\t2.Balance enquiry.";
cout<<endl<<endl<<"\t3.Withdrawal\t4.Quit";
cout<<endl<<endl<<endl<<"\t-->please select your choice:";
cin>>choice;
switch(choice)
{
case 1:
cout<<endl<<endl<<"\tName-Chinmay Mahajan"<<endl<<endl;
cout<<"\t Account no.-0181cs081059"<<endl<<endl<<"\tBranch name-Bhopal";
cout<<endl<<endl<<"\tYour main balance is:"<<a<<endl<<endl<<endl<<"\t\tThank U";
break;
case 2:
cout<<endl<<"\tYour balance is: "<<a<<endl<<endl<<endl<<"\t  Thank U  ";
break;
case 3:
cout<<endl<<"\t your balance is: "<<a<<endl;
cout<<endl<<"\t Please enter your amount:";
cin>>b;
if(b>a)
{
cout<<endl<<endl<<"\tyou have not sufficient balance";
goto out;
}
else
{
c=a-b;
cout<<endl<<endl<<"\tyou have withdrawn Rs. "<<b;
cout<<endl<<endl<<"\tYour balance now:"<<c<<endl<<endl<<"\tThank U";
break;
}
out:
default:
cout<<endl<<endl<<"\tThank U";
}
}
else
{
cout<<endl<<endl<<"\tPassword incorrect";
cout<<endl<<endl<<"\tThank U";
 }
}
void main()
{
clrscr();
Atm A;
A.get();
getch();
}

No comments:

Post a Comment