Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Student class which will contain the following: 1) A String object to h

ID: 3763805 • Letter: C

Question

Create a Student class which will contain the following:
1) A String object to hold a student’s last name
2) An array object to hold five integers representing the student’s grades
3) A method to read in the Student class from a file formatted as:
a) Name on one line by itself
b) Five integer values for the grades on one line delineated by commas
4) A method to display the students name, grades, and average.
An Array class will be used to hold the collection of Student objects. This Array class will have a method to sort the Student records by name.

There will be a maximum of 25 student records in the file, although it may be less.

I understand like the gist of it but I'm having a hard time figuring out how to make a method to read in all the information that could be in the file and save it to the array class

Explanation / Answer

#include<iostream.h>
#include<conio.h>
#include<string.h>
class student
{
int rno,ns;
char name[20];
int *m;
public:
student(int no,char *nm,int nos)
{
rno=no;
strcpy(name,nm);
ns=nos;
m=new int[ns];
}
void get();
void disp();
};
void student::get()
{
for(int i=0;i<ns;i++)
{
cout<<“ Enter the subject “<<i+1<<” Marks” ;
cin>>m[i];
}
}
void student::disp()
{
cout<<“ Student Information: ”;
cout<<“ Roll no: “<<rno;
cout<<“ Name: “<<name;
for(int i=0;i<ns;i++)
{
cout<<“ Marks of “<<i+1<<” Subject: “<<m[i];
}
}
void main()
{
int no,nos;
char nm[20];
clrscr();
cout<<“ Enter roll no name no of subject: ”;
cin>>no>>nm>>nos;
student st(no,nm,nos);
st.get();
st.disp();
getch();
}