I'm trying to read a file that contains integers and strings called club.txt that has the following data.
4
Ami
Ann
Ben
Dan
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
My problem is reading the data into the appropriate variables. The first value (integer) 4 needs to be read into an integer size. This much I have figured out how to do, the rest is beyond me though.
I need to read the names Ami, Ann, Ben, Dan into a string array. Then read the following 1s and 0s into a 2D integer array. My biggest problem is that I have no way of counting which line is read. Any help?
This is what I have so far:
int get_data (int students_friends[][MAX_STUDENTS],string names[], int size)
{
//Local Declarations
int data_in;
int loader;
FILE* fp_data;
I'm also considering making names a char 2D array that reads each char individually.
This is for an intermediate C++ class so we havent covered vectors or anything confusing yet.