Help with Delimiter

Pages: 12
Ok that's awesome. So then to throw them into a bubble sorter would I do that before I output the data or after I output the data?
lol, ask yourself that question :P

Do you need to output sorted data, or not? ahaha.
Sorted data lol. Just wasn't sure if I could carry the variable through all the way until the end or if I had to spit them out twice.
No. Like I mentioned before. 'input' is just a temporary variable to get lines from a file. Then you save accordingly.

After that, you data should be saved in the correct data types for it to be handled.
Omg... I was just looking through the .txt files, and found out that they arent all the same amount of data... So I just can't use

1
2
3
4
getline( iFile, input, '|' );

	getline( iFile, input, '|' );
	students[ i ].State = input;


For where ever I need data from. So stupid..
As long as the data is in the correct field, there will be no problem.

1
2
3
4
5
6
7
firstName, surname, Work travel, age, more, fields, here\n
Dave,Smith,Car,28,moreStuff
Ava,Rogers,Bike,32,more,stuff,that,needed
Carl,Potter,Bike,20,blah
Sonia,Swan,Car,38,chair,cup
Peter,Jonson,Walk,34,post,barn
Mason,Foster,Bike,21,data


If you need data from fields 1, 2 and 4. You can just discard the rest with a simple
getline( iFile, input, '\n' );.
Last edited on
Here is the data from the .txt file, ( just 2 lines of it. )

1063061|OH|Tobias|ppl|Marion|39|101|404118N|0830359W|40.68833|-83.06639|||||985|||Monnett

1080507|OH|Toboso|ppl|Licking|39|089|400323N|0821306W|40.05639|-82.21833|||||805||BGN 1962|Toboso


In the first line the population is 985, but in the second line the population is supposed to be 805 but its one field before it.
but in the second line the population is supposed to be 805


It's in the wrong field? i.e. Who ever gave you this hasn't realized it's wrong?

Have you compared the 'wrong' line with all other's in the text file?

How many are in the 'incorrect' field?

If there's just one out of place, you may want to let your lecturer know about it. To make sure it is/isn't a fault in the file structure!
Last edited on
Topic archived. No new replies allowed.
Pages: 12