(1) CStudentList. H
# pragma once
# include "CStudent. H"
The class CStudentList
{
CStudent * head;
Public:
CStudentList (int n);
CStudentList ();
~ CStudentList ();
};
(2) CStudentList. CPP
# include "CStudentList. H"
# include "CStudent. H"
# include
CStudentList: : CStudentList (int n)
{
The head=new CStudent (" head ", 1, 100);
The head - & gt; Next=NULL;
for (int i=0; i
CStudent * newNode=new CStudent ();
NewNode - & gt; Next=head - & gt; Next;
The head - & gt; Next=newNode;
}
}
CStudentList: : CStudentList ()
{
}
(3) CStudent. H
# pragma once
//list node class
//student
//attributes: name, gender, achievement
//methods: entry, display
The class CStudent
{
Char name [20].
Bool sex;//true for men, false for female
Int score;
Public:
CStudent * next;
CStudent (const char p_name [], bool p_sex, int p_score);//given safety and modify join const
CStudent ();
Void input ();
Void show (int method);//method used to determine the display mode
Char * getName () {return name; }
Bool getSex () {return sex; }
Int getScore () {return score; }
~ CStudent ();
};
(4) CStudent. CPP
# include "CStudent. H"
# include
# include
using namespace std;
CStudent: : CStudent (const char p_name [], bool p_sex, int p_score)
{
Strcpy_s (name, p_name);
Sex=p_sex;
Score=p_score;
}
CStudent: : CStudent ()
{
The input ();
}
Void CStudent: : input ()
{
Cout & lt; <"Please enter the student's name:" & lt;
Cout & lt; <"Please enter the student gender (1 male, 0 for female) :" & lt;
Cin & gt;> Isex;
Sex=isex? True, false;
Cout & lt; <"Please enter the student achievement:" & lt;
}
Void CStudent: : show (int) method
{
The switch (method)
{
Case 0:
Cout & lt;
Case 1:
Cout & lt; <"Name:" & lt;
Default:
break;
}
}
CStudent: : ~ CStudent ()
{
}
(5). The main CPP
//write list node
# include
# include "CStudentList. H"
using namespace std;
Int main ()
{
CStudentList s (2);
//call according to the demand of different display format syntax: s.s how (?)
return 0;
}
Use of software is visual studio 2019
After the operation display error is:
LNK2019 cannot resolve the external symbol of "public: __cdecl CStudentList: : ~ CStudentList (void)" (?????? 1 cstudentlist @ @ QEAA @ XZ), the symbol referenced in the main () function of Student