Advertisement
Sdub

PIN(FINAL) +DEPOSIT(FINAL)

Oct 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. #include <iostream> //accept pin number and verify if correct
  2.  
  3. using namespace std;
  4. int i,trans,dCash,withdrawCash;
  5. char transs;
  6. int currentCash = 1500;
  7. int pin[4];
  8. int existingPin, trialPin, newPin;
  9. int main();
  10. int transactions();
  11. int exitProgram(){
  12. cout << "Good bye.";
  13. exit(0);
  14. }
  15. int moreTransaction(){
  16. cout << "Would you like another transaction?" <<endl;
  17. cout << "y/n"<<endl;
  18. cin >>transs;
  19. switch(transs){
  20. case 'y':
  21. system("cls");
  22. transactions();
  23. case 'n':
  24. cout<< "Thank you for using Budie De Oro. Good bye";
  25. exit(0);
  26. }
  27. }
  28. int depositCash(){
  29. cout<< "DEPOSIT: Select Amount"<<endl;
  30. cout <<"Current cash: "<< currentCash<<endl;
  31. cout<< "<1>P100 <2>P200"<<endl;
  32. cout<< "<3>P500 <4>P1000"<<endl;
  33. cin >> dCash;
  34. switch(dCash){
  35. case 1:
  36. currentCash+=100;
  37. cout << "Successfully deposited: P100 into account"<<endl;
  38. cout <<endl;
  39. moreTransaction();
  40.  
  41.  
  42. case 2:
  43. currentCash+=200;
  44. cout << "Successfully deposited: P200 into account"<<endl;
  45. cout << endl;
  46. moreTransaction();
  47. case 3:
  48. currentCash+=500;
  49. cout << "Successfully deposited: P500 into account"<<endl;
  50. cout << endl;
  51. moreTransaction();
  52. case 4:
  53. currentCash+=1000;
  54. cout << "Successfully deposited: P1000 into account"<<endl;
  55. cout << endl;
  56. moreTransaction();
  57. }
  58. cout <<"Current Cash"<< currentCash;
  59.  
  60. }
  61. int transactions(){
  62. cout << "Welcome, USER " << existingPin<<endl;
  63. cout << "Select transaction"<<endl;
  64. cout << "<1> Deposit"<<endl;
  65. cout << "<2> Withdraw"<<endl;
  66. cin >> trans;
  67. switch(trans){
  68. case 1:
  69. depositCash();
  70. }
  71. }
  72.  
  73. int newPinz(){
  74. cout << "REGISTRATION: Please enter PIN: ";
  75. cin >> pin[0];
  76. existingPin=pin[0];
  77. cout << "New PIN created successfully";
  78. system("cls");
  79. main();
  80.  
  81. }
  82.  
  83. int changePin(){
  84. cout << "CHANGE PIN: Please enter your existing PIN\n";
  85. for(i=0; i<4; i++){
  86. cin >> trialPin;
  87. if(trialPin == existingPin){
  88. cout << "Welcome " << existingPin <<"\n";
  89. cout << "Enter your new PIN ";
  90. cin >> newPin;
  91. existingPin = newPin;
  92. cout << "Your PIN has been changed \n";
  93. cout << endl;
  94. system("cls");
  95. main();
  96. }
  97. else{
  98. cout <<"Error! Please enter PIN : ";}
  99. }
  100. }
  101.  
  102. int existingPinz(){
  103. cout << "Please enter your existing PIN \n";
  104. for (i=1;i<4;i++){
  105. cin >> pin[i];
  106. if(existingPin == pin[i]){
  107. cout << "Validated, Welcome "<< existingPin <<endl;
  108. system("cls");
  109. transactions();
  110. }
  111. else{
  112. cout << "ERROR! PIN IS INCORRECT\n" << "Try again "<<"\n";
  113. main();
  114. }
  115. }
  116. }
  117.  
  118.  
  119.  
  120. int main(){
  121.  
  122. cout << "Welcome to BDO: Budie De Oro"<<endl;
  123. cout <<"<1>Enter New PIN" << endl
  124. <<"<2>Change PIN" << endl
  125. <<"<3>Enter Existing PIN"<<endl
  126. <<"<>EXIT BANK "<<endl;
  127. cin >> trans;
  128. switch(trans){
  129. case 1:
  130. newPinz();
  131.  
  132. case 2:
  133. changePin();
  134.  
  135. case 3:
  136. existingPinz();
  137. }
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement