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:
So I don't have to deal with floats. permillion will never exceed 1 mil in value.Code:class CurrencyAmount{ public: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - long long number; int permillion; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - };
But would double be good enough for this?



LinkBack URL
About LinkBacks


