Repo for Programming MB code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

55 lines
1.1 KiB

#include <iostream>
using namespace std;
int convert()
{
double orig;
double converted;
int currency;
cout << "Enter the original amount (USD): ";
cin >> orig;
cout << "Enter the currency to convert to (1 = peso, 2 = rupee, 3 = pound, 4 = euro): ";
cin >> currency;
switch(currency) {
case 1 :
converted = orig * 22.4;
break;
case 2:
converted = orig * 75.69;
break;
case 3:
converted = orig * 0.8;
break;
case 4:
converted = orig * 0.89;
break;
default:
cout << "Invalid value" << endl;
}
cout << "The converted value is: " << converted << endl;
return 1;
}
int main()
{
bool cont = true;
char contcheck;
while(cont ){
convert();
cout << endl;
cout << "Would you like to continue? Enter y or n: ";
cin >> contcheck;
if(contcheck = 'y'){
cont = true;
} else{
cont = false;
}
}
return 0;
}