Mike 85 83 77 91 76 CSC
Mark 80 90 95 93 48 CSC
Anderson 78 81 11 90 73 BUSS
Blair 92 83 30 69 87 ECE
Suzy 23 83 30 69 87 ARC
Karlos 46 76 90 54 38 MASS-COMM
So i have this file and i am required to read the data of it and output it through the console using structs, i have managed to read Mike's Name and his scores and Faculty but that's where i am stuck, how can i continue reading ?
Here is my code
struct student {
string name;
int scores[5];
string faculty;
};
void main() {
student x;
ifstream myfile("D:\\Test\\MIUCS.txt");
myfile >> x.name;
for (int j = 0; j < 5; j++) {
myfile >> x.scores[j];
}
myfile >> x.faculty;
cout << x.name << " ";
for (int k = 0; k < 5; k++) {
cout << x.scores[k] << " ";
}
cout << x.faculty << endl;
}
Hint: My Prof said to use an array of type student (the struct) which i can't really implement, any help would be appreciated thank you.