is this a bug in iostream? ...
#include
void money_conversion (){
constexpr double dollars_in_yen=0.01;
constexp
No, this is not a bug in the C++ stream classes.
You need to read in the input as a std::string
and extract the value and the currency yourself.
That's because e
is used to separate the significand and the exponent in scientific notation, which is another way of specifying a double
. Threfore 10e
is an invalid double
as it's missing the portion that defines the exponent.
By the way, using GBP, EUR, and JPY (which are the ISO codes for the currencies you want to support) would be less idiosyncratic.