I am working on a project for school and I can't get my readFile function to work. There is something wrong for the arrays that I am putting in.
Here is the text file I am trying to read from:
4
Assign1 200 10
Assign2 100 80
Project 100 45
Midterm 100 30
Here is my code so far:
int readFile(char fileName[])
{
int i = 0;
ifstream input;
int name[10];
int points[10];
int percent[10];
input.open(fileName);
while (!input.eof())
{
input.getline(
i++;
}
input.close();
cout << name[3];
}
It reads the files but it doesn't save it to the array. How would I do this? Also how would I skip the first line in the txt file so I don't read it. Can ou please help? Thank you.