I am reading 5 lines which contain STRING, DOUBLE data. I am reading the string then deleting the last character which is the comma and then read the double. (in is an ifstream variable)
in >> format >> number;
format.erase(format.length() - 1);
However, when reading from the test data below, the 4th number is read as 23.489999999999998 (as shown in debugging and printing). How can I prevent this?
&&&&&&, 456
&&&&&&,&, 1000000
$&&&&.&&, 123.38
&&&.&&&, 23.49
&&&.&&&, 23.4999
&&&E, 45