Guest User

Untitled

a guest
Mar 25th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. void Cal()
  7. {
  8. string Money = "back";
  9. string TotPay = "back";
  10. string Assets = "back";
  11. cout << "At anytime, you can type the word 'back' to go back a step." << endl;
  12. do{
  13. cout << "Enter your total amount of money: ";
  14. cin >> Money;
  15. }while(Money == "back");
  16. do{
  17. cout << "nEnter the total of your payments: ";
  18. cin >> TotPay;
  19. }while(TotPay == "back");
  20. do{
  21. cout << "nEnter the total value of your assets: ";
  22. cin >> Assets;
  23. }while(Assets == "back");
  24. cout << "Your net worth is " << (Money + Assets) - TotPay << "!";
  25.  
  26. }
  27.  
  28. int main()
  29. {
  30. string name;
  31. string yn;
  32. cout << "Enter your name please: ";
  33. cin >> name;
  34. cout << "nHello " << name << ", today we are going to calculate your net worth.n";
  35. do{
  36. Cal();
  37. cout << "Would you like to calculate again? (yes/no)n";
  38. cin >> yn;
  39. }while(yn == "yes");
  40. cout << "See ya!";
  41. return 0;
  42.  
  43. cout << "Your net worth is " << (Money + Assets) - TotPay << "!";
Add Comment
Please, Sign In to add comment