I am trying to print the index of a multi linked list. Each node has two elements- a warehouse number and a tool number. I am printing all the tools in each warehouse. I am having a problem with iterating correctly through the list.
I am not getting the correct values and am having trouble finding the problem in my method.
struct Node
{
int WarehouseNumber;
int ToolNumber;
struct Node *n;
}
void showWarehouses()
{
int tempvalue;
bool flag = false;
struct Node *s;
s = start;
if (start == NULL)
{
cout<<"Unable";
return;
}
s->WarehouseN = tempvalue;
cout<<"Warehouse "<<tempvalue<< ": Tool ";
while(s != NULL)
{
if (s->WarehouseN == tempvalue)
{
flag = true;
cout<< s->ToolN <<" ";
s = s->next;
}
}
}