Guest User

Untitled

a guest
Oct 22nd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. #include "iostream"
  2. #include "string"
  3.  
  4. using namespace std;
  5.  
  6. int Balance = 0;
  7.  
  8. void Print();
  9. void Get();
  10. void Set();
  11.  
  12. int main()
  13. {
  14. setlocale(0, "");
  15. string pass = "1234";
  16. int k;
  17. do
  18. {
  19. cout << "\n 1 - password\n";
  20. cout << " 2 - exit\n";
  21. cout << " Join: ";
  22. cin >> k;
  23. switch (k)
  24. {
  25. case 1:
  26. {
  27. cout << "\npassword: ";
  28. string buf;
  29. cin.get();
  30. getline(cin, buf);
  31. if (buf != pass) cout << "password wrong!\n";
  32. else
  33. {
  34. int l;
  35. do
  36. {
  37. cout << " 1 - Show cash\n";
  38. cout << " 2 - Get cash\n";
  39. cout << " 3 - Make cash\n";
  40. cout << " 0 - Exit\n";
  41. cout << " Join: ";
  42. cin >> l;
  43. switch(l)
  44. {
  45. case 1:
  46. {
  47. Print();
  48. break;
  49. }
  50. case 2:
  51. {
  52. Get();
  53. break;
  54. }
  55. case 3:
  56. {
  57. Set();
  58. break;
  59. }
  60. case 0:
  61. break;
  62. }
  63. } while (l != 0);
  64. break;
  65. }
  66. }
  67. case 2:
  68. {
  69. break;
  70. }
  71. }
  72. } while (k != 2);
  73. }
  74.  
  75. void Print()
  76. {
  77. cout << "\nYour balance: " << Balance << "$" << endl;
  78. }
  79. void Get()
  80. {
  81. int money;
  82. do
  83. {
  84. cout << "How much you want to withdraw: ";
  85. cin >> money;
  86. if (money > Balance) cout << "\nInsufficient funds on account.\n";
  87. } while (money > Balance);
  88. Balance -= money;
  89. }
  90. void Set()
  91. {
  92. int money;
  93. cout << "How much do you want to deposit: ";
  94. cin >> money;
  95. Balance += money;
  96. }
Add Comment
Please, Sign In to add comment