void add(tel *h)
{
tel *p0,*p1,*p2;
p1=h->next;
p0=new tel;
cout<<"輸入要插入結點的姓名和電話號:";
cin>>p0->name>>p0->no;
if(h->next==NULL);
(h->next=p0;p0->next=NULL);
else
{
while((strcmp(p0->name,p1->name)>0)&&(p1->name))
{
p2=p1;
p1=p1->next;
}
if(strcmp(p0->name,p1->name)<=0)
{ if(h->next==p1)
h->next=p0;
else
p2->next=p0;
p0->next=p1;
}
else{p1->next=p0;p0->next=NULL;}
}
cout<<"添加成功!"<<endl;
}
請問是哪個地方的格式錯誤了
uj5u.com熱心網友回復:
不會是作業題吧if(h->next==NULL); //去掉分號
(h->next=p0;p0->next=NULL); //將括號改為 { }
uj5u.com熱心網友回復:
就是留得作業.....uj5u.com熱心網友回復:
程式還是有錯誤轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/80088.html
標籤:基礎類
