ATM machine ask for ATM card or Username and password

#include <iostream>

#include <string>
using namespace std;

int main () {

char c;

system("cls");
cout<<"Welcome to Metrobank:"<<endl;
cout<<"Please choose if you want to use your ATM card"<<endl;
cout<<"or just your USERNAME and PASSWORD\n";
cout<<"1. ATM card"<<endl;
cout<<"2. USERNAME"<<endl;
cout<<"any key: CREDITS"<<endl;
cout<<"Select Choice: ";
cin>>c;


switch (c){
case '1':
system ("cls");
int pin;
float account,amount,yes,no;
char ans,opt;


cout<<"Welcome to Metrobank:"<<endl;
cout<<"Please insert your card:"<<endl;
cout<<"Enter pin:\t";
cin>>pin;cout<<endl;




if(pin!=930110){
system("cls");
cout<<"invalid Pin"<<endl<<endl;
cout<<"Enter pin:\t";
cin>>pin;

if(pin!=930110){
system("cls");
cout<<"invalid Pin"<<endl<<endl;
cout<<"Enter pin:\t";
cin>>pin;

if(pin!=930110){
cout<<"invalid Pin"<<endl<<endl;

if(pin!=930110){
cout<<"You have reach the maximum attempt."<<endl;
cout<<"Sorry. You are not allowed to proceed another transaction."<<endl;
cout<<"Please come again after two days."<<endl;
cout<<"Please, get your card."<<endl;
}
}else{



do{
cout<<"Select Transaction:"<<endl;
cout<<"A.Balance Inquiry:"<<endl;
cout<<"B.Withdrawal:"<<endl;
cin>>opt;

switch(opt){

case'A':
case'a':
system("cls");
cout<<"Saving Account=2000:"<<endl;
break;

case'B':
case'b':
system ("cls");
cout<<"Do you want to withdraw?:\t"<<endl;
cin>>yes or no;
cout<<"Enter amount if you want to withdraw:\t"<<endl;
cin>>amount;
cout<<"Please wait your transaction is being process:\t"<<endl;
cout<<"Please get your card,money,receipt:\t"<<endl;
break;
}
cout<<"Another Transaction?:[]";
cin>>ans;
system("cls");
}while(ans=='y'||ans=='Y');

}}else{

do{
cout<<"Select Transaction:"<<endl;
cout<<"A.Balance Inquiry:"<<endl;
cout<<"B.Withdrawal:"<<endl;
cin>>opt;




switch(opt){
case'A':
case'a':
system("cls");
cout<<"Saving Account=2000:"<<endl;

break;
case'B':
case'b':
system ("cls");
cout<<"Do you want to withdraw?:\t"<<endl;
cin>>amount;
cout<<"Enter amount if you want to withdraw:\t"<<endl;
cin>>amount;
cout<<"Please wait your transaction is being process:\t"<<endl;
cout<<"Please get your card,money,receipt:\t"<<endl;

break;


}
cout<<"Another Transaction?:[y]";
cin>>ans;
system("cls");
}while(ans=='y'||ans=='Y');

}

}
else{

do{
cout<<"Select Transaction:"<<endl;
cout<<"A.Balance Inquiry:"<<endl;
cout<<"B.Withdrawal:"<<endl;
cin>>opt;




switch(opt){
case'A':
case'a':
system("cls");
cout<<"Saving Account=2000:"<<endl;

break;
case'B':
case'b':
system ("cls");

cout<<"Enter amount if you want to withdraw:\t"<<endl;
cin>>amount;
cout<<"Please wait your transaction is being process:\t"<<endl;
cout<<"Please get your card,money,receipt:\t"<<endl;

break;


}
cout<<"Another Transaction?:[y/n]";
cin>>ans;
system("cls");
}while(ans=='y'||ans=='Y');

}

system("pause");

return main();


break;


case '2':
system("cls");
string Usern,knight,User;
float y,x, pin1;
double balance =0, balance2;
double withdraw, deposit;
int option;

cout<<"if not yet registered please press \"1\""<<endl;
cout<<"if registered press \"2\""<<endl;
cin>>x;cout<<endl;
if (x==1){
system("cls");
cout<<"Your Username: \t ";
cin>>User;cout<<endl;
cout<<"Your Password: \t";
cin>>pin1;
return main ();
}if (x=='2'){
system ("cls");
cout<<"Please Enter your Username:"<<endl;
cin>>Usern;cout<<endl;
if (Usern==User){
{
cout <<"Enter Password: "<<endl;
cin>>y;
if (y=123456){
cout<<" ***Welcome to Metrobank***"<<endl;
cout<<"*** Automated Teller Machine***"<<endl;
cout<<"Choose a Transaction:\n";
cout<<"\n";
cout<<"[1] Inquire Balance \n"
<<"[2] Withdraw \n"
<<"[3] Deposit \n"
<<"[4] Quit \n"
<<"\n"
<<"Enter Option:";
cin>>option;

switch(option)
{
case 1:
system("cls");
cout<<"\n[[[BALANCE INQUIRY]]]\n";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"\n Your current balance is $"<<balance2<<endl;
system("pause");
return main();
break;
case 2:
system("cls");
cout<<"\n[[[WITHDRAW]]]\n";
cout<<"Enter amount: $";
cin>>withdraw;
if (balance2<withdraw){
balance = balance2 - withdraw;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"You withdrew $"<<withdraw<<endl;
cout<<"Your remaining balance is $"<<balance<<endl;
}else{
cout<<" you have insufficient balance: "<<endl;
}
system("pause");
break;
case 3:
system("cls");
cout<<"\n[[[DEPOSIT]]]\n";
cout<<"Enter amount: $";
cin>>deposit;

balance2 = balance + deposit;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"You deposited $"<<deposit<<endl;
cout<<"Your new balance is $"<<balance2<<endl;
system("pause");
return main();
case 4:
system("cls");
cout<<"\n***[[[EXIT MODE]]]***\n";
system("pause");

break;


default:
cout<<"\n That is an invalid option \n";
system("pause");
return main();

break;


}




}


}
cout<<"Created by: Group 1 BSIT-2 D2"<<endl;
cout<<" the Group Members are:"<<endl;
cout<<"\t - RONEL ANTATAP"<<endl;
cout<<"\t - MARK JAMES SORIANO"<<endl;
cout<<"\t - CHESKA TERADO"<<endl<<endl;
cout <<"thank you:\n\n"<<endl;
cout<<"GOD BLESS:"<<endl;


}}}

system("pause");

return 0;
}





||| I need help about this .ASAP
Are you receiving errors?
If yes, then post them. Also please edit your post above with code tags--the <> button, that comes when editing.
You need to make use of functions so you don't have repetitious code.

It might be useful to post the actual assignment text. Did they want you to use classes?
Topic archived. No new replies allowed.