2 dimensional Arrays

the file looks like this
1h 0.7 0.4 0.2 0.4 -0.1 -0.2 -0.3
1as 0.7 0.4 0.2 0.4 -0.1 -0.2 -0.3
1df 0.7 0.4 0.2 0.5 -0.1 -0.2 -0.3
1d 0.7 0.4 0.2 0.5 -0.1 -0.2 -0.3
1cz 0.7 0.4 0.2 0.6 -0.1 -0.2 -0.3
1v 0.7 0.4 0.2 1.1 -0.2 -0.4 -0.6
2dj 0.7 0.4 0.2 1.3 -0.2 -0.4 -0.6
2e 0.7 0.4 0.2 1.3 -0.2 -0.4 -0.6
2wo 0.7 0.6 0.3 1.8 -0.3 -0.6 -0.9
2n 0.7 0.6 0.3 1.8 -0.3 -0.6 -0.9
2pz 0.7 0.6 0.3 2.1 -0.3 -0.6 -0.9

the function looks like this
int inputData(ifstream& inFile, string name[], double scores[][7])
{
int number = 0;

inFile>>name[number]

return number;
}
how would i read this into the program using inFile????
i used getline but thats not working so far...
1
2
int number = 0;
inFile >> name[number];

That is a good start. You have now read "1h" from the file.

If you can read a word to a string variable with a >>,
could you perhaps read a number into double variable with >> too?

You do have a fundamental problem though. How large are the arrays vs how many lines does the file have?
Topic archived. No new replies allowed.