Hi everyone,
I have a simple setback in my program. I'm not the best way to go about doing this. I'm trying to do it in the simplest way possible. I have an input file that looks like this

2.5 600 -2
10 20 30

I want to sort each line using my own sort algorithm, but I want to work on one line at a time, storing the numbers in a vector. I think one solution is to use getline and put it into a strstream and maybe extract the values one at a time from the stream. This way I can separate it by lines. The problem is I want to IN the float values, so I don't know how to test for a newline if I'm using something (psuedo-code) like cin >> int x Any ideas?

I think one solution is to use getline and put it into a strstream and maybe extract the values one at a time from the stream. This way I can separate it by lines.

Yes that is the best way to do it

The problem is I want to IN the float values, so I don't know how to test for a newline if I'm using something (psuedo-code) like cin >> int x Any ideas?

Why do you want to test for a newline?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.