using?namespace?std;
struct?room{
int?romnum;
room?*next;
};
struct?hotel
{
char?name[50];
room*?pr;//指向room的指針
hotel*?ph;//指向下壹個hotel的指針。
};
void?initHotle(hotel*?&hp)
{
hp->ph=NULL;
hp->pr=NULL;
}
void?print(hotel*?&hp)
{
hotel*?temp=hp->ph;
if(temp==NULL)?cout<<"沒有酒店數據";
else{
while(temp){
cout<<temp->name;
temp=temp->ph;
}
}
}
void?findHotelRoomInfomation(char*?hname){
查鏈表,找到hname相匹配的,提出它的room頭指針,然後遍歷輸出唄。easy我就不填了。
自己搞。
}
int?main(){
hotel*?p=new?hotel();
initHotle(p);
print(p);
?
}
思路就是這樣,清晰不?關於鏈表數據的增刪查就不用我在添了吧?........再給妳畫個邏輯圖。
鏈表操作的話,自己慢慢填了啊............