PROGRAM M-BANGKING C++

Adipurnamaa
2 min readDec 28, 2022

--

Oleh Adi purnama— 1227050004

Jurusan Teknik Informatika UIN Sunan Gunung Djati Bandung

Deskripsi Umum

Program dibawah ini adalah program M — bangking

Source Code

#include<iostream>
#include<conio.h>
using namespace std;

int main(){

//Local Variable Declarations
string iuser, ipass;
const string user = "1227050004";
const string pass = "uinsgdbandung";
string name = "Adi Purnama";
char choice;
int index = 1;
int chance = 1;
int command = 0;
int money = 0;
int balance = 100;

//login
while (index <= 1){

for(iuser != user; ipass !=pass; chance++ ){
cout<<endl;
cout<<"\t M-Banking\n";
cout<<"=========================================\n";
cout<<"Grove Street M-Banking Login\n";
if(chance <= 3){
cout<<"Enter your user id = ";
getline (cin, iuser);
cout<<"Enter your password = ";
getline (cin, ipass);
system("cls");
}else if(chance > 3){
cout<<"\nToo many attempt!\nRestart the App!";
getch();
return 0 ;
}
}system("cls");


cout<<"\t Grove Street M-Banking\n";
cout<<"\t-----------------------\n";
cout<<"1.Deposit Money-\n";
cout<<"2.Withdraw Money\n";
cout<<"3.Print Balance\n";
cout<<"4.Account Detail\n";
cout<<"0.Quit\t\t\t\n";
cout<<"\t-----------------------\n";
cout<<"=>Enter Number: ";
cin>>command;
system("cls");




//Command prompt
switch (command){
//Ending Program
case 0://Quit
index = 2;
break;

//Deposit Money
case 1:
cout<<"==============================\n";
cout<<"=>Enter Deposit Amount: $";
cin>>money;
cout<<"==============================\n";
if(money > 60 || money < 1)
cout<<"You Deposited above/below our maximum! Max($60)\n\n";
else{
balance = balance + money;
cout<<" Deposit Success\n\n";
}
cout<<"=>Do you want to do anything else?(y/n) ";
cin>>choice;
if(choice == 'Y' || choice == 'y')
index = 1;
else if (choice == 'N' || choice == 'n')
index= 2;
else cout<<"Oops Try again!";
break;



case 2:
cout<<"==============================\n";
cout<<"=>Enter Withdraw Amount: $"; cin>>money;
cout<<"==============================\n";
if (money > 1 && money <= (balance-10)) {
balance = balance - money;
cout<<"Withdraw Success\n\n";
}
else cout<<"Oops Try Again!\nYou can't have less than 10 balance!\n\n";
cout<<"=>Do you want to do anything else?(y/n) ";
cin>>choice;
if(choice == 'Y' || choice == 'y')
system("cls");
else if (choice == 'N' || choice == 'n')
index= 2;
break;



case 3:
cout<<"==============================\n";
cout<<"Current Balance: $"<<balance<<endl;
cout<<"==============================\n\n";
cout<<"=>Do you want to do anything else?(y/n) ";
cin>>choice;
if(choice == 'Y' || choice == 'y')
system("cls");
else if (choice == 'N' || choice == 'n')
index= 2;
break;


case 4:
cout<<"============ Account Detail =============\n";
cout<<"\tUser Id\t\t: "<<user<<endl;
cout<<"\tPassword\t: "<<pass<<endl;
cout<<"\tName\t\t: "<<name<<endl;
cout<<"\tInterest\t: 3.5%"<<endl;
cout<<"=======================================\n\n";
cout<<"=>Do you want to do anything else?(y/n) ";
cin>>choice;
if(choice == 'Y' || choice == 'y')
system("cls");
else if (choice == 'N' || choice == 'n')
index= 2;
break;

default:
cout<<"Oops Try Again! You Enter an invalid command\n\n";
cout<<"=>Do you want to do anything else?(y/n) ";
cin>>choice;
if(choice == 'Y' || choice == 'y')
system("cls");
else if (choice == 'N' || choice == 'n')
index= 2;
break;
}
}
system("cls");
cout<<"\t M-Banking\nSee You Later Dear Costumer!\n\n";
cout<<"Press any key to exit";
getch();


return 0;
}

Output

--

--