#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
int mainMenu();
int userMenu();
void userBalance();
void userwí†hdráw();
void userDeposit();
double balance =0.0;
int main(){
string inputName="";
int inputPin=0;
string name= "";
int pin=0 ;
char input='y';
cout <<"Do you have existing account?";
cin>>input;
if (input !='y'){
cout << "Welcome Please Create your account Here."<<endl;
cout << "Create Name: ";
cin >> inputName;
cout << "Create 6 digit pin: ";
cin >> inputPin;
}
cout <<" WELCOME" <<endl;
cout <<"Login Your Account" << endl;
cout << "\n Enter Name: ";
cin >> name;
cout << "\n Enter PIN: ";
cin >> pin;
while (name != inputName || pin != inputPin)
{
cout << endl<< endl;
cout <<"You Entered An Invalid Account" << endl;
cout << "Enter Name: ";
cin >> name;
cout << "Enter Pin: ";
cin >> pin;
cout << "\n";
}
userMenu();
return 0;
}
int userMenu(){
switch(mainMenu()){
case 1:
userBalance();
userMenu();
break;
case 2:
userwí†hdráw();
userMenu();
break;
case 3:
userDeposit();
userMenu();
break;
case 4:
cout <<"Exitting...";
userMenu();
break;
default:
cout <<"Invalid Input."<< endl;
cout <<"Please Select 1-4. "<< endl;
break;
}
return 0;
}
int mainMenu(){
int input =0;
cout <<"\tMENU"<<endl<<endl;
cout <<"Select Your Transaction"<< endl<< endl;
cout <<"1. BALANCE "<<endl;
cout <<"2. WIDTHRAW "<< endl;
cout <<"3. DEPOSITE "<< endl;
cout <<"4. EXIT "<< endl;
cout <<endl<<endl;
cout <<"Enter your Transaction: ";
cin >> input;
return input;
}
void userBalance(){
cout <<"Account Balance :"<< balance<< endl;
}
void userWidthraw(){
double widthraw =0.0;
cout <<"Enter Amount to Widthraw: ";
cin >> widthraw;
cout<< endl<<endl;
if (balance >widthraw){
cout <<"You Have not Enough Balance.";
cout <<"Please Enter Enough Balance to Widthraw: ";
cin >>widthraw;
}
if (balance <widthraw){
balance =balance -widthraw;
cout <<"You Widthraw "<< widthraw <<"In Your Account."<< endl;
cout <<"Your Balance Is Now " << balance << endl;
}
}
void userDeposit(){
double deposite =0.0;
cout <<"Enter Amount To Deposite "<< endl;
cin >>deposite;
balance = balance +deposite;
cout <<"You Have Succesfully Deposite "<< deposite<< "From Your Account."<< endl;
cout <<"Your Balance Is now "<< balance << endl;
}
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
int mainMenu();
int userMenu();
void userBalance();
void userwí†hdráw();
void userDeposit();
double balance =0.0;
int main(){
string inputName="";
int inputPin=0;
string name= "";
int pin=0 ;
char input='y';
cout <<"Do you have existing account?";
cin>>input;
if (input !='y'){
cout << "Welcome Please Create your account Here."<<endl;
cout << "Create Name: ";
cin >> inputName;
cout << "Create 6 digit pin: ";
cin >> inputPin;
}
cout <<" WELCOME" <<endl;
cout <<"Login Your Account" << endl;
cout << "\n Enter Name: ";
cin >> name;
cout << "\n Enter PIN: ";
cin >> pin;
while (name != inputName || pin != inputPin)
{
cout << endl<< endl;
cout <<"You Entered An Invalid Account" << endl;
cout << "Enter Name: ";
cin >> name;
cout << "Enter Pin: ";
cin >> pin;
cout << "\n";
}
userMenu();
return 0;
}
int userMenu(){
switch(mainMenu()){
case 1:
userBalance();
userMenu();
break;
case 2:
userwí†hdráw();
userMenu();
break;
case 3:
userDeposit();
userMenu();
break;
case 4:
cout <<"Exitting...";
userMenu();
break;
default:
cout <<"Invalid Input."<< endl;
cout <<"Please Select 1-4. "<< endl;
break;
}
return 0;
}
int mainMenu(){
int input =0;
cout <<"\tMENU"<<endl<<endl;
cout <<"Select Your Transaction"<< endl<< endl;
cout <<"1. BALANCE "<<endl;
cout <<"2. WIDTHRAW "<< endl;
cout <<"3. DEPOSITE "<< endl;
cout <<"4. EXIT "<< endl;
cout <<endl<<endl;
cout <<"Enter your Transaction: ";
cin >> input;
return input;
}
void userBalance(){
cout <<"Account Balance :"<< balance<< endl;
}
void userWidthraw(){
double widthraw =0.0;
cout <<"Enter Amount to Widthraw: ";
cin >> widthraw;
cout<< endl<<endl;
if (balance >widthraw){
cout <<"You Have not Enough Balance.";
cout <<"Please Enter Enough Balance to Widthraw: ";
cin >>widthraw;
}
if (balance <widthraw){
balance =balance -widthraw;
cout <<"You Widthraw "<< widthraw <<"In Your Account."<< endl;
cout <<"Your Balance Is Now " << balance << endl;
}
}
void userDeposit(){
double deposite =0.0;
cout <<"Enter Amount To Deposite "<< endl;
cin >>deposite;
balance = balance +deposite;
cout <<"You Have Succesfully Deposite "<< deposite<< "From Your Account."<< endl;
cout <<"Your Balance Is now "<< balance << endl;
}