c++ ATM MACHINE SAMPLE CODES

//ATM MACHINE PROGRAM//
//originally programmed by Marc Daniel Mateo//
#include<conio.h>
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
char option,yn, ch;
string pin ="", pin2 ="", pinc="1234";
int amount, withdraw, balance=50000,balance2;
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
cout<<"\t***************************************************************"<<endl;
cout<<"\t** **"<<endl;
cout<<"\t** WELCOME TO UCC-HS ATM MACHINE **"<<endl;
cout<<"\t** **"<<endl;
cout<<"\t***************************************************************"<<endl;
cout<<"\n\n\nEnter Your card..... "<<endl;
system("pause");

step1:
system("cls");
cout<<"\t***************************************************************"<<endl;
cout<<"\t**(1)Deposit (3)Balance Inquiry**"<<endl;
cout<<"\t** **"<<endl;
cout<<"\t**(2)Withdraw (4)Exit**"<<endl;
cout<<"\t** (5)Change Pin **"<<endl;
cout<<"\t***************************************************************"<<endl;
cout<<"------------------------------CHOOSE YOUR OPTION-------------------------------"<<endl;
cout<<"OPTION: "; cin>>option;

switch(option)
{
case '1': cout<<"\n----DEPOSIT-----"<<endl;
cout<<"\nEnter Amount You want to Deposit: "; cin>>amount;
system("pause");
cout<<endl<<"Transaction Has Done!!"<<endl;
balance=balance+amount;
cout<<"You Have: "; cout<<balance;
cout<<"\n----------------"<<endl;
cout<<"Do You Wish Transact More or Exit? (y/n): "; cin>>yn;
if(yn=='y') goto step1;
else if(yn=='n') cout<<"\nTHANK YOU FOR USING OUR MACHINE!!"; return 0;

case'2': cout<<"\n------Withdraw------"<<endl;
cout<<"Enter Amount You Want to Withdraw: "; cin>>withdraw;
if(withdraw>>balance)
{
cout<<"Sorry, you don't have enough balance to transact"<<endl;
system("pause");
system("cls");
goto step1;
}
system("pause");
cout << "Enter pin: ";
ch = _getch();
while(ch != 13)
{
pin.push_back(ch);
cout << '*';
ch = _getch();
}
if(pin == pinc)
{
cout << "\nAccess granted :P\n"; goto step2;
}
else
{
cout << "\nAccess aborted...\n"; system("pause"); goto step1;
}
step2:
cout<<endl<<"Transaction Has Done!!"<<endl;
balance=balance-withdraw;
cout<<"Your Remaining Balance is: "; cout<<balance;
cout<<"\n----------------"<<endl;
cout<<"Do You Wish Transact More? (y/n): "; cin>>yn;
if(yn=='y') goto step1;
else if(yn=='n') cout<<"\nTHANK YOU FOR USING OUR MACHINE!!"; return 0;

case '3': cout<<"\n-------BALANCE INQUIRY-------"<<endl;
cout<<"You Have: "<<balance;
cout<<"\n-----------------------------";
cout<<"\nDo You Wish Transact More or Exit? (y/n): "; cin>>yn;
if(yn=='y') goto step1;
else return 0;

case '4':cout<<"\n--------EXIT--------";
cout<<"\nThank You For Using Our Bank!!!";
cout<<"\nRemoving Card....."<<endl;
system("pause");
return 0;

case '5': cout<<"\n-------Change Pin-------";
cout <<"\nEnter pin: ";
ch = _getch();
while(ch != 13)
{
pin.push_back(ch);
cout << '*';
ch = _getch();
}
if(pin == pinc)
{
cout << "\nAccess granted :P\n"; goto newpin;
}
else
{
cout << "\nAccess aborted...\n"; system("pause"); goto step1;
}

newpin:
cout<<"\nEnter New Pin: ";
ch = _getch();
while(ch != 13)
{
pin2.push_back(ch);
cout << '*';
ch = _getch();
}
pinc=pin2;
cout<<"\nPin has been successfully chaged! :) ";
cout<<"\nDo You Wish Transact More or Exit? (y/n): "; cin>>yn;
system("pause");
if(yn=='y') goto step1;
else return 0;

//there's still problem on changing pin :D :D :D :D//


break;
default: system("cls"); goto step1;
}

}
please help me fix changing the pin program.
Topic archived. No new replies allowed.