Last active
September 5, 2020 21:04
-
-
Save Carmenchu83/a5e80eebcd9d64de6cd7cfe552da2516 to your computer and use it in GitHub Desktop.
Changes your money currency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
The program asks you the currency of your money, the currency to which you would like to change and your money amount. | |
The currency exchange used is: 1€ / 1,17$ - 1€ / 0.91 £ - 1,28 $ / 1 €. | |
*******************************************************************************/ | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main () | |
{ | |
string currency1; | |
string currency2; | |
float money1; | |
float change; | |
cout << "The currencies that you may introduce are: \n dolars (1) \n euros (2) \n pounds (3) \n \n"; | |
cout << "Please, introduce the actual currency of your money \n"; | |
cin >> currency1; | |
cout << "\n"; | |
cout << "Please, introduce the currency to which you would like to change \n"; | |
cin >> currency2; | |
cout << "\n"; | |
cout << "Please, introduce the money amount you would like to change \n"; | |
cin >> money1; | |
cout << "\n"; | |
if (currency1 == "euros") | |
{ | |
if (currency2 == "dolars") | |
{ | |
change = money1 * 1.17; | |
cout << "The currency change of your euros equals to: " << change << " $" << | |
"\n"; | |
} | |
else if (currency2 == "pounds") | |
{ | |
change = money1 * 0.91; | |
cout << "The currency change of your euros equals to: " << change << " £" << | |
"\n"; | |
} | |
else | |
{ | |
cout << "That currency isn´t available in this moment"; | |
} | |
} | |
if (currency1 == "dolars") | |
{ | |
if (currency2 == "euros") | |
{ | |
change = money1 / 1.17; | |
cout << "The currency change of your dolars equals to: " << change << " €," | |
<< "\n"; | |
} | |
else if (currency2 == "pounds") | |
{ | |
change = (money1 * 0.91) / 1.28; | |
cout << "The currency change of your dolars equals to: " << change << " £" | |
<< "\n"; | |
} | |
else | |
{ | |
cout << "That currency isn´t available in this moment"; | |
} | |
} | |
if (currency1 == "pounds") | |
{ | |
if (currency2 == "euros") | |
{ | |
change = money1 / 0.91; | |
cout << "The currency change of your pounds equals to: " << change << " €" | |
<< "\n"; | |
} | |
else if (currency2 == "dolars") | |
{ | |
change = money1 * 1.28; | |
cout << "The currency change of your pounds equals to: " << change << " $" << | |
"\n"; | |
} | |
else | |
{ | |
cout << "That currency isn´t available in this moment"; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment