I'm having trouble reading from file and saving the data into integer / double variables.
These are the contents of the file I have to read from.
& Student Roll Number, Student Name, CGPA
09i-0947, Peter Clark, 2.01
09i-01716, James Morrison, 2.02
10i-0024, William Craft, 2.09
The code should ignore all lines starting with an & sign.
Then I have to save the starting 2 numbers in an integer variable called batch. The numbers after the "-" sign in an integer called rollnumber. Then the name and then the CGPA in a double variable. It should ignore the commas and the spaces. This is what I've come up with as yet but I don't know what to do next.
I have tried various other methods like string tokenizing etc but failed.
int x=0, y=0;
char batch, roll, name, cgpa;
char batcha, rolla, namea, cgpaa;
status = true;
fin.getline(roll[count], 5, ',');
fin.getline(name[count], 30, ',');
fin.getline(cgpa[count], 5, '\n');