多谢 斑竹提醒,本人 奋斗一夜 终于搞定!
太谢谢斑竹了!!
程序如下:
#include<iostream.h>
class NODE
{
 friend class LIST;
 friend class Set;
 NODE * NEXT;
 float DATA;
};
class LIST
{
private:
 NODE *HEAD;
public:
 LIST()
 {
  HEAD=0;
 }
NODE *GET_HEAD() 
{
   
 return(HEAD);
}
 void push(float Data)
 {
  NODE *P=new NODE;
  P->DATA=Data;
  if(HEAD==0)
  {
   P->NEXT=0;
   HEAD=P;
  }
  else
  {
   P->NEXT=HEAD;
   HEAD=P;
  }
 }
 void pop(float  Data)
 {
  NODE * q;
  NODE *n;
  q=HEAD;
 
  while(q!=0)
  {
   if(q->NEXT->DATA==Data)
   {
             n=q->NEXT;
    q->NEXT=n->NEXT;
    delete n;
    break;
   }
   else
    q=q->NEXT;
  }
 }
 void display()
 {
  NODE *m;
  m=HEAD;
  float b;
  
  while(m!=0)
  {
   b=m->DATA;
   cout<<b<<" ";
   m=m->NEXT;
  }
 }
 };
class Set
{
private:
 LIST list;
public:
    void jiaoji(LIST & A,LIST &B,LIST &C)
{
  
  NODE *a;
  NODE *b;
  NODE *c;
  a=A.GET_HEAD();
  b=B.GET_HEAD();
  c=C.GET_HEAD();
  c=0;
 while(a!=0)
 { 
  b=B.GET_HEAD();
   while(b!=0)
   {
    if(a->DATA==b->DATA)
    {
     C.push(a->DATA);
    
     b=0;
    }
    else 
    {
     b=b->NEXT;
    }
   }
   a=a->NEXT; 
  }
}
};
int main()
{
 LIST A;
    LIST B;
    LIST C;
 
 Set D;
 float i;
 cout<<"press A:";
 while(cin>>i,i!=0)
 {
  A.push(i);
 }
    cout<<"the set A is:";
 A.display();
 cout<<endl;
 cout<<"press B:";
 while(cin>>i,i!=0)
 {
  B.push(i);
 }
    cout<<"the set B is:";
 B.display();
 cout<<endl;
 D.jiaoji(A,B,C);
 if(C.GET_HEAD()==0)
    cout<<"the jiaoji is:"<<"NULL";
 else
     cout<<"the jiaoji is:";
 cout<<endl;
 C.display();
 return 0;
}