Hello im having a problem with my program. Im trying to read in twofiles called
ID: 3615504 • Letter: H
Question
Hello im having a problem with my program. Im trying to read in twofiles called list.txt and teachers.txt and set them to an arraycalled studentList[] and teacherList[] but i dont know how to dothat, any suggestions? This is the code i have so far:typedef struct { char StLastName[THIRTY]; char StFirstName[THIRTY]; int Grade; int Classroom; } student;
typedef struct { char TLastName[THIRTY]; char TFirstName[THIRTY]; int Classroom; } teacher;
int main() { student studentList[TWO_HUNDRED]; teacher teacherList[FIFTY];
FILE *in; FILE *in2; in = fopen("list.txt","r"); in2 = fopen("teachers.txt","r"); return 0; }
These are the two sample files:
students file: CAR MAUDE 2 101
KRISTENSEN STORMY 6 112
VANDERWOUDE SHERWOOD 3 107
NOGODA ISMAEL 0 105
teachers file: MACROSTIE MIN 101
COVIN JEROME 102
MOYER OTHA 103
typedef struct { char StLastName[THIRTY]; char StFirstName[THIRTY]; int Grade; int Classroom; } student;
typedef struct { char TLastName[THIRTY]; char TFirstName[THIRTY]; int Classroom; } teacher;
int main() { student studentList[TWO_HUNDRED]; teacher teacherList[FIFTY];
FILE *in; FILE *in2; in = fopen("list.txt","r"); in2 = fopen("teachers.txt","r"); return 0; }
These are the two sample files:
students file: CAR MAUDE 2 101
KRISTENSEN STORMY 6 112
VANDERWOUDE SHERWOOD 3 107
NOGODA ISMAEL 0 105
teachers file: MACROSTIE MIN 101
COVIN JEROME 102
MOYER OTHA 103
typedef struct { char StLastName[THIRTY]; char StFirstName[THIRTY]; int Grade; int Classroom; } student;
typedef struct { char TLastName[THIRTY]; char TFirstName[THIRTY]; int Classroom; } teacher;
int main() { student studentList[TWO_HUNDRED]; teacher teacherList[FIFTY];
FILE *in; FILE *in2; in = fopen("list.txt","r"); in2 = fopen("teachers.txt","r"); return 0; }
These are the two sample files:
students file: CAR MAUDE 2 101
KRISTENSEN STORMY 6 112
VANDERWOUDE SHERWOOD 3 107
NOGODA ISMAEL 0 105
teachers file: MACROSTIE MIN 101
COVIN JEROME 102
MOYER OTHA 103
typedef struct { char StLastName[THIRTY]; char StFirstName[THIRTY]; int Grade; int Classroom; } student;
typedef struct { char TLastName[THIRTY]; char TFirstName[THIRTY]; int Classroom; } teacher;
int main() { student studentList[TWO_HUNDRED]; teacher teacherList[FIFTY];
FILE *in; FILE *in2; in = fopen("list.txt","r"); in2 = fopen("teachers.txt","r"); return 0; }
These are the two sample files:
students file: CAR MAUDE 2 101
KRISTENSEN STORMY 6 112
VANDERWOUDE SHERWOOD 3 107
NOGODA ISMAEL 0 105
teachers file: MACROSTIE MIN 101
COVIN JEROME 102
MOYER OTHA 103