using namespace std;
The template & lt; The class DataType>
Struct Node
{
DataType data;
Node
};
The template & lt; The class DataType>
The class LinkList
{
Public:
Void DeleteSame ();
Void PrintList ();
Private:
Node
The template & lt; The class DataType>
Void LinkList
{
Node
While (p!=NULL)
{
Cout & lt; P=p - & gt; Next;
}
Cout & lt;
The template & lt; The class DataType>
Void Linklist
{
Node
P=first - & gt; Next;
For (p; p!=NULL; P=p - & gt; Next)
{
S=p;
For (q=p - & gt; Next; q!=NULL; )
{
If (q - & gt; data=https://bbs.csdn.net/topics/=p-> data)
{
S - & gt; Next=q - & gt; Next;
The delete q;
Q=s - & gt; Next;
}
The else
{
S=q;
Q=q - & gt; Next;
}
}
}
}
Int main () {
Int r [6]=,2,3,4,5,3 {1};
LinkList
cout<& lt;" The original data is: ";
L.P rintList ();
L.D eleteSame ();
cout<& lt;" Delete the data of the: ";
L.P rintList ();
return 0;
}