63 839
Assignments Done
99,2%
Successfully Done
In August 2018

Answer to Question #69257 in C++ for Nathan

Question #69257
On a certain day the British pound was equivalent to $1.487 U.S., the French franc was $0.172,
the German deutschemark was $0.584, and the Japanese yen was $0.00955. Write a program that
allows the user to enter an amount in dollars, and then displays this value converted to these four
other monetary units.
Expert's answer
void PrintExchangeRates(const double i_dollars_amount)
{
const double british_pound_rate = 1.487;
const double french_franc_rate = 0.172;
const double german_deutschemark_rate = 0.584;
const double japanese_yen_rate = 0.00955;
std::cout << i_dollars_amount << "$ equals to : " << std::endl;
std::cout << (i_dollars_amount / british_pound_rate) << " British pounds" << std::endl;
std::cout << (i_dollars_amount / french_franc_rate) << " French francs" << std::endl;
std::cout << (i_dollars_amount / german_deutschemark_rate) << " German deutschemarks" << std::endl;
std::cout << (i_dollars_amount / japanese_yen_rate) << " Japanese yens" << std::endl;
}


int main() {
std::cout << "Enter amount of dollars" << std::endl;
double dollars_amount ;
std::cin >> dollars_amount;
PrintExchangeRates(dollars_amount);
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions