Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //accept pin number and verify if correct
- using namespace std;
- int i,trans,dCash,withdrawCash;
- char transs;
- int currentCash = 1500;
- int pin[4];
- int existingPin, trialPin, newPin;
- int main();
- int transactions();
- int exitProgram(){
- cout << "Good bye.";
- exit(0);
- }
- int moreTransaction(){
- cout << "Would you like another transaction?" <<endl;
- cout << "y/n"<<endl;
- cin >>transs;
- switch(transs){
- case 'y':
- system("cls");
- transactions();
- case 'n':
- cout<< "Thank you for using Budie De Oro. Good bye";
- exit(0);
- }
- }
- int depositCash(){
- cout<< "DEPOSIT: Select Amount"<<endl;
- cout <<"Current cash: "<< currentCash<<endl;
- cout<< "<1>P100 <2>P200"<<endl;
- cout<< "<3>P500 <4>P1000"<<endl;
- cin >> dCash;
- switch(dCash){
- case 1:
- currentCash+=100;
- cout << "Successfully deposited: P100 into account"<<endl;
- cout <<endl;
- moreTransaction();
- case 2:
- currentCash+=200;
- cout << "Successfully deposited: P200 into account"<<endl;
- cout << endl;
- moreTransaction();
- case 3:
- currentCash+=500;
- cout << "Successfully deposited: P500 into account"<<endl;
- cout << endl;
- moreTransaction();
- case 4:
- currentCash+=1000;
- cout << "Successfully deposited: P1000 into account"<<endl;
- cout << endl;
- moreTransaction();
- }
- cout <<"Current Cash"<< currentCash;
- }
- int transactions(){
- cout << "Welcome, USER " << existingPin<<endl;
- cout << "Select transaction"<<endl;
- cout << "<1> Deposit"<<endl;
- cout << "<2> Withdraw"<<endl;
- cin >> trans;
- switch(trans){
- case 1:
- depositCash();
- }
- }
- int newPinz(){
- cout << "REGISTRATION: Please enter PIN: ";
- cin >> pin[0];
- existingPin=pin[0];
- cout << "New PIN created successfully";
- system("cls");
- main();
- }
- int changePin(){
- cout << "CHANGE PIN: Please enter your existing PIN\n";
- for(i=0; i<4; i++){
- cin >> trialPin;
- if(trialPin == existingPin){
- cout << "Welcome " << existingPin <<"\n";
- cout << "Enter your new PIN ";
- cin >> newPin;
- existingPin = newPin;
- cout << "Your PIN has been changed \n";
- cout << endl;
- system("cls");
- main();
- }
- else{
- cout <<"Error! Please enter PIN : ";}
- }
- }
- int existingPinz(){
- cout << "Please enter your existing PIN \n";
- for (i=1;i<4;i++){
- cin >> pin[i];
- if(existingPin == pin[i]){
- cout << "Validated, Welcome "<< existingPin <<endl;
- system("cls");
- transactions();
- }
- else{
- cout << "ERROR! PIN IS INCORRECT\n" << "Try again "<<"\n";
- main();
- }
- }
- }
- int main(){
- cout << "Welcome to BDO: Budie De Oro"<<endl;
- cout <<"<1>Enter New PIN" << endl
- <<"<2>Change PIN" << endl
- <<"<3>Enter Existing PIN"<<endl
- <<"<>EXIT BANK "<<endl;
- cin >> trans;
- switch(trans){
- case 1:
- newPinz();
- case 2:
- changePin();
- case 3:
- existingPinz();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement