string to double
Posted on 2004-11-28
I am trying to read a file one line at a time ,tokenize a string with space delimiter. Then convert the lines to objects.
the lines in the file are in this format
A 100000.12 0.08 11
S 100000.12 0.08 11
now I am trying to read this file and tokenize them with space delimiter so that I can create objects from them.
if(ss >> buff)
if(buff == "A")
//(double prin, double rate, int length)
What is Interesting is that though both principal and rate are declared as double. it is not reading the values like 10000.12 or 100000.12 . it is taking out the single digit or both the digits after the decimal depending on the size of the number. what is the problem here.