Hello.
I'm trying to read an input file to build a list formed by structs.
The input file has this format:
1 2,15 3,0
2 1,15 3,8
...
the first number of each line will be in what I call NOMBRE, and for the rest of the numbers in the same line, one will be an ADJ and next one will be a PERTE, then again next number ADJ, next PERTE.
Example:
NOMBRE:1 ADJ:2 PERTE:15 ADJ:3 PERTE:0
NOMBRE:2 ADJ:1 PERTE:15 ADJ:3 PERTE:8
However I cann't figure how to stop the loop for the ADJs and PERTEs in order to get the next line work properly, begining with a NOMBRE.
What I get is::
NOMBRE:1 ADJ:2 PERTE:15 ADJ:3 PERTE:0
ADJ:2 PERTE:1 ADJ:15 PERTE:3 ADJ:8
my code :
while(!Lecture.eof())
{
Lecture>>PtrSommet->nombre;
cout<<"NOMBRE" <<PtrSommet->nombre;
do
{
type_adj *PtrAdj;
PtrAdj=new type_adj();
Lecture>>PtrAdj->nombre;
cout<<" ADJ" <<PtrAdj->nombre;
Lecture.ignore(1)>>PtrAdj->perte;
cout<<" PERTE " <<PtrAdj->perte <<".";
}while ([B]?????[/B]);
}
what do I need to put in the do while to finish the line? something like do while (line ends).
BTW. I know that the pointers generation is wrong and the thing about avoiding eof, this code is just for testing purposes.
Thanks.