What's the best data structure for currency exchange?
The exchange rate goes something like this:
1 Euro = 1.3552
First I was going to use double, but then I thought this class could do better:
Code:
class CurrencyAmount{
public:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
long long number;
int permillion;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
};
So I don't have to deal with floats. permillion will never exceed 1 mil in value.
But would double be good enough for this?