i need some help to develop a function for a link list you basically have to
1. Add 25 students with (ID ,Name, Department and Grade)
2. Print the name and the score of top three students from each department
3. Print the average of each department (CE, CS, IT)
i couldn't figure out how to develop the print function.
return;
}
void department::printstudent()
{
student *current;
current = head;
if( head==NULL )
{
cout << "EMPTY"<<endl;
return;
}
while (current != NULL)
{
cout << current-> id <<current->name <<current ->grade <<endl;
current = current->next;
}
return;
}
int main()
{
cout<<"Enter the depertament name"<<endl;
string na;
getline (cin,na);
department S;
S.init();
cout<<"How many students are in "<<na<<endl;
int n;
cin>>n;
int saw; string san;char ga;
for(int i=1;i<=n;i++)
{
cout<<" Enter the student "<<i<<" id"<<endl;
cin>>saw;
cout<<"Enter the "<< i<< " student name"<<endl;
cin>>san;
cout<<"enter the "<<i<<"student grade"<<endl;
cin>>ga;
getline (cin,san);
if(S.exist(saw))
{
cout<<"this course is exist, Enter another id "<<endl; i--;
}
else
{
S.addstudent(saw,san,ga);
}
}
cout<<"Enter a course id to be deleted : ";
int x;
cin>>x;
S.deletestudent(x);