Re: Airplane Program with Linked Lists. The linked list ****tion is very confusing to me.
by "Chris Thomasson" <cristom@[EMAIL PROTECTED]
>
Mar 7, 2008 at 04:42 PM
"jawdoc" <drbrooks@[EMAIL PROTECTED]
> wrote in message
news:e66bcfe8-d62d-442f-b333-2ac4eb1b737a@[EMAIL PROTECTED]
> I just need some direction for using the linked lists instead
> of the 2 dimensional arrays. Both versions are provided. Any help is
> greatly appretiated.
This should help get you started:
___________________________________________________________
class airplane {
struct seat {
seat* next;
// [...]
};
struct row {
row* next;
seat* seats;
};
row* m_rows;
seat* find_seat(int row, int col) const {
row* r = m_rows;
while (r && row > 1) {
row--;
r = r->next;
}
if (r && row == 1) {
seat* s = r->seats;
while (s && col > 1) {
col--;
s = s->next;
}
if (s && col == 1) {
return s;
}
}
return NULL;
}
public:
// [...]
};
___________________________________________________________