aboutsummaryrefslogtreecommitdiff
path: root/CST 126/Homework 1/conversion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST 126/Homework 1/conversion.cpp')
-rw-r--r--CST 126/Homework 1/conversion.cpp108
1 files changed, 108 insertions, 0 deletions
diff --git a/CST 126/Homework 1/conversion.cpp b/CST 126/Homework 1/conversion.cpp
new file mode 100644
index 0000000..f31d50d
--- /dev/null
+++ b/CST 126/Homework 1/conversion.cpp
@@ -0,0 +1,108 @@
+//#include "header.h"
+//
+////Loop to run the conversion while the user wants to
+//void run_conversion(char again)
+//{
+// while (toupper(again) != 'N')
+// {
+// float input_choice = 0;
+// float output_choice = 0;
+// float conversion = 0.0;
+// float amount = 0.0;
+//
+// cout << "Choose your input currency: ";
+// currency_menu();
+// cin >> input_choice;
+// cin.ignore(100, '\n');
+// cout << "\nchoose your output currency: ";
+// cin >> output_choice;
+// cin.ignore(100, '\n');
+// cout << "\nWhat is the amount you would like to convert: ";
+// cin >> amount;
+// cin.ignore(100, '\n');
+// conversion = convert(input_choice, output_choice, amount);
+// cout << "In the new currency, that amount is " << conversion << std::endl;
+// cout << "\nDo you want to use the conversion tool again? (Y/N): ";
+// cin >> again;
+// cin.ignore(100, '\n');
+// if (toupper(again) != 'Y')
+// {
+// cout << "Thank you for using the currency conversion tool! \n";
+// }
+// }
+//}
+//
+////Conversion Calculator
+//float convert(float input, float output, float amount)
+//{
+// float converted_amount = 0.0;
+// struct currencies
+// {
+// const float GBP = 0.80;
+// const float Euro = 0.94;
+// const float Yen = 152.22;
+// const float AUD = 1.55;
+// const float USD = 1;
+// };
+//
+// currencies currency;
+//
+// if (input == output)
+// {
+// return amount;
+// }
+// if (input == 1)
+// {
+// input = currency.GBP;
+// }
+// else if (input == 2)
+// {
+// input = currency.Euro;
+// }
+// else if (input == 3)
+// {
+// input = currency.Yen;
+// }
+// else if (input == 4)
+// {
+// input = currency.AUD;
+// }
+// else if (input == 5)
+// {
+// input = currency.USD;
+// }
+//
+// if (output == 1)
+// {
+// output = currency.GBP;
+// }
+// else if (output == 2)
+// {
+// output = currency.Euro;
+// }
+// else if (output == 3)
+// {
+// output = currency.Yen;
+// }
+// else if (output == 4)
+// {
+// output = currency.AUD;
+// }
+// else if (output == 5)
+// {
+// output = currency.USD;
+// }
+//
+// converted_amount = output / input * amount;
+// return converted_amount;
+//}
+//
+////Menu display
+//void currency_menu()
+//{
+// cout << "\n\n1. GBP\n";
+// cout << "2. Euro\n";
+// cout << "3. Yen\n";
+// cout << "4. AUD\n";
+// cout << "5. USD\n\n";
+//} \ No newline at end of file