Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6. int _tmain(int argc, _TCHAR* argv[])
  7. {
  8. //declare variables
  9. double balance, deposit, withdraw;
  10. int option;
  11.  
  12. balance = 500; //default amount
  13.  
  14. do
  15. {
  16. cout <<"\n\t*************MENU****************";
  17. cout <<"\n\t* *";
  18. cout <<"\n\t* 1. Check Balance *";
  19. cout <<"\n\t* 2. Deposit *";
  20. cout <<"\n\t* 3. Withdraw *";
  21. cout <<"\n\t* 4. Transfer *";
  22. cout <<"\n\t* 5. Exit *";
  23. cout <<"\n\t* *";
  24. cout << "\n\t*********************************";
  25. cout << "\n\t Please choose an option: ";
  26. cin>> option;
  27.  
  28. switch (option){
  29.  
  30. case 1: cout << "\n\tYour Balance is: $"<<balance <<endl;
  31. break;
  32.  
  33. case 2: cout << "\n\tAmount you want to deposit: $";
  34. cin>>deposit;
  35. balance += deposit;
  36. cout<<"\n\t Current Balance: $" << balance <<endl;
  37. break;
  38.  
  39. case 3: cout << "\n\tHow much do you want to withdraw?: $";
  40. cin>> withdraw;
  41.  
  42. if(balance < withdraw)
  43. cout << "\n\tYou do not have enough money in your account to withdraw"<<endl;
  44. else
  45. balance -= withdraw;
  46.  
  47. cout<<"\n\t Current Balance: $" << balance <<endl;
  48. break;
  49.  
  50. default: if(option != 5)
  51. cout<< "\n\tInvalid option. Please try again" <<endl;;
  52. break;
  53. }
  54.  
  55. } while (option != 5);
  56.  
  57.  
  58. system("pause");
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement