#include <iostream>
using namespace std;
struct LinkNode;
typedef int ElementType;
typedef LinkNode *PtrToNode;
typedef PtrToNode List;
typedef PtrToNode Position;
struct LinkNode{
ElementType data;
Position next;
};
class ARR{
List list;
public:
void delSame(int a[],int size);
Position findNode(Position,int);
void sumSame();
void disPlay();
};
void ARR::delSame(int a[],int size){
Position p,s,r;
list=(List)malloc(sizeof(LinkNode));
p=list;
p->next=NULL;
int count=1;
for(int i=0;i<size;i++){
r=ARR::findNode(p,a[i]);
if(r==NULL){
s=(List)malloc(sizeof(LinkNode));
s->data=a[i];
p->next=s;
p=s;
p->next=NULL;
}
}
}
Position ARR::findNode(Position l,int data){
Position p;
p=l;
while(p&&p->data!=data){
p=p->next;
}
return p;
}
void ARR::disPlay(){
Position p;
p=list->next;
while(p){
cout<<p->data<<" ";
p=p->next;
}
cout<<endl;
}
int main(){
int a[]={1,2,2,3,4,4,5,6,6,7,8,8,8,9,10,10};
int num=sizeof(a)/sizeof(int);
ARR listARR;
listARR.delSame(a,num);
listARR.disPlay();
return 0;
}