i'm looking to get a first name followed by four scores and finally a last name, stored into multiple arrays (a char *array, a float array, & a char *array). getting the scores i understand however the names are pointer arrays. as far that goes what am i doing wrong here
char *FNs[50]; //Student's First Names.
char *LNs[50]; //Student's Last Names.
ifstream text("data5.txt", ios::in);
if(text.is_open())
char Name[20];
while(i<50 && text>>Name[])
{
newPtr = new char[20];
strcpy(newPtr, Name);
FNs[i] = newPtr;
text>>Scores[i][0];
text>>Scores[i][1];
text>>Scores[i][2];
text>>Scores[i][3];
text>>Name;
i++;
}
text.close();
}
example data i want to input:
Jane Doe
13.1 82.4 99.0 66.2
John M. Smith
48.1 58.2 12.3 99.1
Bill Forest
88.8 99.2 48.1 60.5
and so on