Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sitha

macrumors newbie
Original poster
Jul 13, 2006
4
0
Hi Everybody,

I am writing a program to deal datas from a file.
My code is,

while(getline(input, buff)) {
// getline(input, buff);
if (buff.find("ELEMENTS")!= string::npos) {
found2 = true;
break;
}

istringstream tmp(buff);
// format the output
string a, b, c, d, e;
tmp >> a >> b >> c >> d >> e;
cout<< b << " " << c << " " << d << endl;
output << b << " " << c << " " << d << endl;
}


Here I am reading datas as string, But I want to do erithmetic operation to my datas so I changed string to double.
Now this the problem, Say my input is as follows,

10 20 25 60 75
23 12 23 63 25
12 63 25
When I use as string it works good, but when i put double it copys the datas as follows,

20 25 60 75
12 23 63 25
63 25 63 25
It put the previous line data to the empty space. How can I debug it. Please help me.

Sitha.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.