diff options
Diffstat (limited to 'CST 126/Homework 1/currency.hpp')
| -rw-r--r-- | CST 126/Homework 1/currency.hpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/CST 126/Homework 1/currency.hpp b/CST 126/Homework 1/currency.hpp index 50bf14e..3523183 100644 --- a/CST 126/Homework 1/currency.hpp +++ b/CST 126/Homework 1/currency.hpp @@ -107,7 +107,7 @@ inline int ValidateInput(int input) { cin >> input; - while (input < 1 || input > 8) + while (input < 1 || input > 7) { cout << "\nInvalid Option, please pick again: "; cin >> input; @@ -118,8 +118,8 @@ inline int ValidateInput(int input) { inline void Input (int &original, int &convertTo, double &value) { - cout << "*********************************************************************" << endl; - cout << "1. USD\n2. CAD\n3. EUR\n4. GBP\n5. INR\n6. AUD\n7.CHF\n"; + cout << "*********************************************************************\n"; + cout << "1. USD\n2. CAD\n3. EUR\n4. GBP\n5. INR\n6. AUD\n7. CHF\n"; cout << "Pick the number of the input currency: "; original = ValidateInput(original); cout << "\nWhat is the value of this currency to two decimal places: "; @@ -128,6 +128,19 @@ inline void Input (int &original, int &convertTo, double &value) convertTo = ValidateInput(convertTo); } +inline bool ConvertMore() +{ + char again; + + cout << "\nWould you like to convert more currency? (Y/N): "; + cin >> again; + + if (again == 'Y') + return true; + else + return false; +} + inline void PickCurrency() { int original = 0; @@ -145,9 +158,10 @@ inline void PickCurrency() { cout << "The converted value is " << fixed << setprecision(2) << value << " in "; CurrencyName(convertTo); - cout << "." << endl; + cout << ".\n"; - WaitEnter(); + if (ConvertMore() == true) + PickCurrency(); } |