Since you seem stuck, I'll give you a basic idea where to start
Change your insert method to accept an int, and perform insertion from outside.
class linklist
{
...
void insert(int val);
}
void outerfunction()
{
for (size_t i = 0; i < max; ++i)
{
int aValue;
cin >> aValue;
mylinklist.insert(aValue);
}
}
Create access functions to your data. This can be done in a number of ways:
1. Access by index
int getAt(size_t index) const; int& getAt(size_t index);
2. Expose pointers to your internal structure (node), but encapsulate it well.
Either implement something like iterators a la stl, or create your own type like POSITION as used by the MFC framework. The latter might be easier to implement if you're new to C++. All you have to do is to cast you node pointers to a POSITION type, and only expose that type from your list. To access the data you can accept such a POSIION value in a method, and type cast it back to a node pointer.
typedef void* POSITION; POSITION getHead() { return first; }
int getAt(POSITION p) const { return ((node*) p)->data; }
void next(POSITION &p) const { p = ((node*) p)->next; }
Don't forget to do NULL checks on parameters.
Even though the iterator implementation is harder, you will have the benefit of using standard algorithms such as searching and sorting, without the need of implementing them yourself.
Now, your show() function can then be moved out of the class, and only use the access functions you have created.
Also, no-one outside your linklist class needs to know about the internals.
Move the declaration of node to inside the linklist class and make it protected.
If you do all this properly, you will have no problem making it a template class, which can hold other data types. Not just ints.
Hope this will get you in the right direction.