Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <algorithm>
  4. #include <String>
  5. #include <vector>
  6. std::vector<int> mynumbers {45617078};
  7. static const std::string name;
  8. void makeanaccount(){
  9. std::cout << "What is your name?";
  10. std::cin >> name;
  11. std::cout << name << "?" << "Nice name!";
  12. int accountnum = rand();
  13. mynumbers.push_back(accountnum);
  14. std::cout << "Your account number is " << accountnum << "Have a good day!";
  15.  
  16. }
  17. //The account
  18. char account(std::string nam, int bal) {
  19. double bal = 0;
  20. std::cout << "Welcome, " << nam << ".\n" << "Your balance is: " << bal << "\n";
  21. std::cout << "Would you like to make a deposit? Y/N\n";
  22. char choice;
  23. std::cin >> choice;
  24. if (choice == 'Y' || choice == 'y') {
  25. std::cout << "Okay, how much would you like to deposit?\n";
  26. double dep = 0;
  27. std::cin >> dep;
  28. bal = dep + bal;
  29. std::cout << "Your money has been deposited. Your balance is: " << bal;
  30. } else if (choice == 'N' || choice == 'n') {
  31. std::cout << "Okay then. How about withdrawl? Y/N\n";
  32. char alsochoice;
  33. std::cin >> alsochoice;
  34. if (alsochoice == 'Y' || alsochoice == 'y') {
  35. std::cout << "Okay, how much would you like to withdrawl?";
  36. double wdr = 0;
  37. std::cin >> wdr;
  38. bal = bal - wdr;
  39. std::cout << "Your money has been withdrawn. Your balance is\n " << bal;
  40. std::cout << "Would you like to do another transaction? Y/N\n";
  41. char ch;
  42. std::cin >> ch;
  43. if (ch == 'Y' || ch == 'y'){
  44. account(name, 0);
  45. }
  46. else {
  47. std::cout << "See ya later!\n";
  48. exit(0);
  49. }
  50. }
  51. }
  52. void chicken(){
  53. std::cout << "Welcome to Bank. Press 1 if you already have an account, or 2 if you do not.\n";
  54. int ch;
  55. std::cin >> ch;
  56. if (ch == 1){
  57. pinsystem();
  58. }
  59. else{
  60. makeanaccount();
  61. }
  62. }
  63.  
  64. void pinsystem() {
  65. std::cout << "Please input your account number.\n";
  66. int accountguess;
  67. std::cin >> accountguess;
  68. if(accountguess == mynumbers[0]){
  69. account(name, 0);
  70. } else {
  71. std::cout << "Sorry, but it's wrong.";
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement