# include
# include
# include
# include
# include
# include
using namespace std;
Struct student {
Long id;
String name;
Int score;
Student * next;
Student * head;
};
Student * generatelist (const char * filename)
{
Ifstream file (" Score. TXT ");
Int independence idx=0;
The string line, part;
Student * head;
Student * p;
The head=(struct student *) malloc (sizeof (struct student));
The head - & gt; Next=NULL;
P=the head - & gt; Next=(struct student *) malloc (sizeof (struct student));
While (getline (file, line))
{
Stringstream ss (line);
Getline (ss, part, ' ');
While (idx
=2){
If (independence idx==0)
P - & gt; Id=stol (part);
Else if (independence idx==1)
P - & gt; Name=part;
Else if (independence idx==2)
P - & gt; Score=stoi (part);
Idx++;
}
P - & gt; Next=(struct student *) malloc (sizeof (struct student));
P=p - & gt; Next;
}
P - & gt; Next=NULL;
return head;
}
Void returnname (student * stulist, long id)
{
Student * p=stulist;
While (p - & gt; Id!=id & amp; & p!=NULL)
{
P=p - & gt; Next;
}
If (p!=NULL)
coutThe else
cout<" Could not find "& lt;
Void returnscore (student * stulist, long id)
{
Student * p=stulist;
While (p - & gt; Id!=id & amp; & p!=NULL)
{
P=p - & gt; Next;
}
If (p!=NULL)
cout}
Int main ()
{
Student * stulist=generatelist (" Score. TXT ");
Long xuehao;
cout<" Please enter a student id: ";
cin> Xuehao;
Returnname (stulist xuehao);
Returnscore (stulist xuehao);
}