hey everyone.
I'm writing a code to read student information from file and store them in an ordered doubly linked list.
the list should be ordered according to the student ID.
The information in the file aren't ordered.
I had a problem in the function which reads from file and store the information in the list
i tried to separate them in two functions , it didn't work .
So any suggestions to solve the problem??
Do you have to use a DLL? (Double linked-list). It'd be a lot easier to store them in a map using student id as key, as this is naturally ordered.
Regarding your actual code, some basic commenting would've hurt. You should also put braces around the statement on Line 40. If one execution path of a conditional statement has braces then so should the others, it aids in readability.
Line 26: Why are you moving your only valid pointer to the new Node to it's Next Object? Unless Next currently points to "this"; in which case it'd still be pointless. You're also not re-setting your "found" variable to false after each attempt. Correcting those should point you in the right direction.