I am having issues getting this function to work. This is a currency conversion program that gives the user choices of input of three other currencies other than USD and converts it. It is supposed to be a value returning function, not a void function. The program compiles, runs fine, but only gives me the number "1" as the output. Any help in the write direction is appreciated. Thank you.
using namespace std;
double calculate (double dollars, const double toEuros, const double toYen, const double toRupees);
const double toEuros = .826925; // conversion rates
const double toYens = 118.511;
const double toRupees = 44.1650;
const double euros = 1.20185;
const double yens = .00840795;
const double rupees = 0226501;
string symbol1 = "USD", symbol2 = "USD";
int main()
{
double dollars, result;
cout << "This is a conversion program for U.S. dollars into euros,yens, and rupees or vice versa" << endl;
// get input
cout << "Please enter the three-letter symbol of the original currency: ";
cin >> symbol1;
cout << endl;
cout << "Please enter the three-letter symbol of the resulting currency: ";
cin >> symbol2;
cout << endl;
cout << "Please enter the amount to be converted: ";
cin >> dollars;
cout << calculate << endl;
return 0;
}
double calculate (double dollars, const double toEuros, const double toYen, const double toRupees)
{
double result;
if (symbol1 == "USD" || symbol1 == "usd")
{
if (symbol2 == "EUR" || symbol2 == "eur")
{
result = dollars * toEuros;
cout << dollars << " USD" << setw(20) << result << " EUR"<< endl;
}
else if (symbol2 == "JPY" || symbol2 == "jpy")
{
result = dollars * toYens;
cout << dollars << " USD" << setw(20) << result << " JPY"<< endl;
}
else if (symbol2 == "INR" || symbol2 == "inr")
{
result = dollars * toRupees;
cout << dollars << " USD" << setw(20) << result << " INR"<< endl;
}
}
else if (symbol1 == "EUR" || symbol1 == "eur")
{
result = dollars * euros;
cout << dollars << " EUR" << setw(20) << result << " USD"<< endl;
}
else if (symbol1 == "JPY" || symbol1 == "jpy")
{
result = dollars * yens;
cout << dollars << " JPY" << setw(20) << result << " USD"<< endl;
}
else if (symbol1 == "INR" || symbol1 == "inr")
{
result = dollars * rupees;
cout << dollars << " INR" << setw(20) << result << " USD"<< endl;
}
else
cout << endl << "You did not enter a valid currency symbol";
}