QUOTE(BitByte @ 28 Nov, 2006 - 07:14 AM)

Because you are reading the line, which is a string. Then you are adding total to price, which are both floats with the value 0. So your output will be zero. There are no values in them.
Edit: What is your text file like?
My text file is
sale items
Paper 10.00
dog food 15.00
I just kept it simple so I could figure it out.
QUOTE(horace @ 28 Nov, 2006 - 07:58 AM)

QUOTE(mistic857 @ 28 Nov, 2006 - 01:58 PM)

"also where do read the value of price?"
I think this is where I am getting stuck. I am not sure how to go about it
to read it.
what does your data file look like, if it is a list of prices such as
10.0 20.0 30.0
40.0 50.0
etc
you replace your statement
CODE
getline (cost,line);
with something like
CODE
cost >> price;
then add price to total, etc
So complete replace that line?
Do I have to change my variable to a sting?
I really am confused....