Currency conversions

The following program takes in amount in US dollars and converts it into another currency. Create the functions that match the prototypes. Make sure that functions return the converted dollars into the proper currency. These values should be defined as constants in the global section so that any change in the exchange rate can be made there and nowhere else in the program.

One dollar = 0.74 euros
One dollar = 12.93 Mexican pesos
One dollar = 100.22 Japanese yen

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <iomanip>

using namespace std;

// This program will get an amount in US dollars and convert it 
// to another currency

// Prototypes of the functions
float convertToYen(float dollars);
float convertToEuros(float dollars);
float convertToPesos(float dollars);

int main ()
{  
   float dollars, euros, pesos, yen;
   cout << fixed << showpoint << setprecision(2);
   cout << "Please input the amount of US Dollars " 
        << "you want converted: ";
   cin >> dollars;

   //  Fill in the code to convert to yen, euros, and pesos
   // and display the results

   return 0;
}
What are you asking? Do you need the calculations?

If so the calculations are provided in the question for you

One dollar = 0.74 euros.

So, I am just in my first semester of logic and I am not very advanced at code yet. How we do constants so far is like this:

const float converToEuros = 0.74;

You would need another statement to ask the user how he wants to convert it.

Then you would probably want to make a loop based on the input.

An example of the calculation would be:

euros = dollars * convertToEuros;

Im not really sure what you are asking but I hope that helps you.

Topic archived. No new replies allowed.