Convert dollars to euros, pesos, etc.

I need to convert 100 dollars to pesos, yens and euros. One US dollar maps to 18 Pesos, 0.89 Euros, and 111.28 Yen. it need to be in a table, with a width of 15 characters. the table basically has Dollars Yen Euros Pesos and underneath it has the output.

I have no clue where to start, please help! this is a hint we got: Pesos, Euros and Yen defined as const double values in your program
(I am not asking for anyone to do it for me, i just need help starting it)
Last edited on
How would you do it on paper?

Here is how I would do it on paper.

Calculate 100 * 18 (this is number of pesos)
Calculate 100 * 0.8 (this is number of euros)
Calculate 100 * 111.28 (this is number of yen)

Write out a line that says:

Dollars Yen Euros Pesos

Under that, write out 100, and a space, and the number of yen, and a space, and the number of euros, and a space, and the number of pesos.

Can you do that on paper?

Once you know how to do it on paper, can you do it in code?
Last edited on
but am i supposed to write the number or is it supposed to automatically do that once i enter 100 us dollars or whatever as the input?
Well, that would depend on what the instructions say. The hint does imply that you're meant to have the program do the calculation. So this program is probably not acceptable:

1
2
cout << "Dollars Yen Euros Pesos" << '\n';
cout << "100 11128 80 180";
Last edited on
Oh, okay I see..
So i set up the titles, but could you help me with where i should put the formulas?

//This program is able to convert US dollars to Mexican Pesos, Yens, and Euros
//

#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
cout << setw(15) << "Dollars" << setw(15) << "Yen" << setw(15) << "Euros" << setw(15) << "Pesos" << setw(15) << endl << endl;

}
You need to create some numbers to output, right? So they're going to go in the line that starts "cout", because that's when they will be output. So you need to calculate those numbers before that line.
Topic archived. No new replies allowed.