Traditional Culture Encyclopedia - Hotel reservation - I would like to ask how to insert another linked list into the linked list in c. For example, the hotel is a node of the first linked list, and then each room is a node of the second linked list.

I would like to ask how to insert another linked list into the linked list in c. For example, the hotel is a node of the first linked list, and then each room is a node of the second linked list.

#include?lt;iostreamgt;

using?namespace?std;

struct?room{

int?romnum;

room?*next;

};

struct?hotel

{

char?name[50 ];

room*?pr; //Pointer to room

hotel*?ph; //Pointer to next hotel.

};

void?initHotle(hotel*?amp;hp)

{

hp-gt;ph=NULL;

hp-gt; pr=NULL;

}

void?print(hotel*?amp; hp)

{

hotel*?temp=hp-gt;ph;

if(temp==NULL)?coutlt;lt;"No hotel data";

else {

while(temp){

coutlt;lt;temp-gt;name;

temp=temp-gt;ph;

}

}

}

void?findHotelRoomInfomation(char*?hname){

Look up the linked list and find a match for hname , raise its room head pointer, and then traverse the output. I won't fill it in for easy.

Do it yourself.

}

int?main(){

hotel*?p=new?hotel();

initHotle(p) ;

print(p);

?

}

This is the idea, is it clear? Regarding the addition and deletion of linked list data, there is no need for me to add it, right? ........Draw you another logic diagram.

If you want to operate a linked list, fill it in slowly yourself......