很早以前的了 看打家有用没
#include<iostream>
#include<iomanip>
#include<malloc.h>
#include<string>
using namespace std;
struct Date{
 int year;
 int mon;
 int day;
};
typedef struct{
     double key;
     char name[20];
     char sex[8];
        Date date1;
        char adress[50];
        double tel;
}ElemType;
typedef struct BiTNode{
 ElemType data;
 struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
#define EQ(a,b) ((a)==(b))
#define LT(a,b) ((a)< (b))
#define LQ(a,b) ((a)> (b))
 BiTree p=NULL,s=NULL;
bool SearchBST(BiTree T,double key,BiTree f,BiTree &p){
       if(!T){
        p=f;return false;
       }
       else if EQ(key,T->data.key){
              p=T;return true;
       }
    else if LT(key,T->data.key)return SearchBST(T->lchild,key,T,p);
    
       else return SearchBST(T->rchild,key,T,p);
}//SearchBST
BiTree Search_BST(BiTree T,double key){
       if(!T||EQ(key,T->data.key))return(T);
       else if LT(key,T->data.key)return(Search_BST(T->lchild,key));
    else return Search_BST(T->rchild,key);
}//SearchBST
void Input_Information(BiTree &T,ElemType e);  
bool InsertBST(BiTree &T,ElemType e){
       
       if(!SearchBST(T,e.key,NULL,p)){
         s=(BiTree)malloc(sizeof(BiTNode));
        Input_Information(s,e);
        s->lchild=NULL;s->rchild=NULL;
         if(!p)T=s;
         else if LT(e.key,p->data.key)p->lchild=s;
         else p->rchild=s;
         return true;
       }
       else return false;
}//insert
void Input_Information(ElemType &e){
  cout<<"intput telphone NO:";
  cin>>e.key;
  cout<<"intput name:";
  cin>>e.name;
  cout<<"intput sex:";
  cin>>e.sex;
  cout<<"intput date(Year/month/day):";
  cin>>e.date1.year
        >>e.date1.mon
        >>e.date1.day;
  cout<<"intput adress:";
  cin>>e.adress;
  cout<<"intput other Telphone NO:";
  cin>>e.tel;
}//information
void Input_Information(BiTree &T,ElemType e){
  T->data.key=e.key;
  strcpy(T->data.name,e.name);
  strcpy(T->data.sex,e.sex);
  T->data.date1.year=e.date1.year;
  T->data.date1.mon=e.date1.mon;
  T->data.date1.day=e.date1.day;
  strcpy(T->data.adress,e.adress);
  T->data.tel=e.tel;
}//information
void print(BiTree T){
       
 cout<<"姓名:"<<T->data.name<<endl
        <<"电话:"<<setiosflags(ios::fixed)<<T->data.key<<endl
        <<"性别:"<<T->data.sex<<endl
        <<"生日:"<<T->data.date1.year<<"年"
                  <<T->data.date1.mon<<"月"
                        <<T->data.date1.day<<"日"<<endl
        <<"地址:"<<T->data.adress<<endl
        <<"其他常用号码:"<<setiosflags(ios::fixed)<<T->data.tel;
}//print
void main(){
  ElemType e;
  int loop=1;
  double key;
  string str;
  BiTree Root,q;
  Root=(BiTree)malloc(sizeof(BiTNode));
  Root->lchild=NULL;
  Root->rchild=NULL;
  //Input_Information(Root);//根
  while(loop){
     Input_Information(e);
     if(!InsertBST(Root,e))return;
        cout<<"是否继续输入电话薄联系人信息?(Y OR N)";
        cin>>str;
        if(str=="Y"||str=="y")
        loop=1;
        else loop=0;
  }
  cout<<"是否查找联系人详细信息?(Y OR N):";
  cin>>str;
  loop=(str=="Y"||str=="y")?1:0;
  while(loop){
   cout<<"输入查找人的电话号码:";
   cin>>key;
   if(q=Search_BST(Root,key))
   print(q);
   else cout<<"查找失败!"<<endl;
   cout<<"是否继续查找其他联系人?(Y OR N):";
   cin>>str;
   loop=(str=="Y"||str=="y")?1:0;
  }
  
}//main

 
											





