Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Cal()
- {
- string Money = "back";
- string TotPay = "back";
- string Assets = "back";
- cout << "At anytime, you can type the word 'back' to go back a step." << endl;
- do{
- cout << "Enter your total amount of money: ";
- cin >> Money;
- }while(Money == "back");
- do{
- cout << "nEnter the total of your payments: ";
- cin >> TotPay;
- }while(TotPay == "back");
- do{
- cout << "nEnter the total value of your assets: ";
- cin >> Assets;
- }while(Assets == "back");
- cout << "Your net worth is " << (Money + Assets) - TotPay << "!";
- }
- int main()
- {
- string name;
- string yn;
- cout << "Enter your name please: ";
- cin >> name;
- cout << "nHello " << name << ", today we are going to calculate your net worth.n";
- do{
- Cal();
- cout << "Would you like to calculate again? (yes/no)n";
- cin >> yn;
- }while(yn == "yes");
- cout << "See ya!";
- return 0;
- cout << "Your net worth is " << (Money + Assets) - TotPay << "!";
Add Comment
Please, Sign In to add comment