Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int answer, balance, amount;
  6.  
  7. cout << "Welcome!" << endl;
  8. cout << "Enter your balance: ";
  9. cin >> balance;
  10.  
  11. cout << "-----------------------------------------" << endl;
  12. cout << "Select an option:" << endl;
  13. cout << "1. Withdraw Amount" << endl;
  14. cout << "2. Deposit Amount" << endl;
  15. cout << "3. Exit" << endl;
  16. cout << "-----------------------------------------" << endl;
  17. cout << "Choice: ";
  18. cin >> answer;
  19.  
  20. while( answer != 3 ) {
  21. if( answer == 1 ) {
  22. cout << "How much amount you want to withdraw from your account?" << endl;
  23. cout << "Amount: ";
  24. cin >> amount;
  25.  
  26. balance -= amount;
  27. cout << "Your new balance is: " << balance << endl;
  28. } else if( answer == 2 ) {
  29. cout << "How much amount you want to deposit in your account?" << endl;
  30. cout << "Amount: ";
  31. cin >> amount;
  32.  
  33. balance += amount;
  34. cout << "Your new balance is: " << balance << endl;
  35. } else {
  36. cout << "Invalid input" << endl;
  37. }
  38.  
  39. cout << "Choice: ";
  40. cin >> answer;
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement