If I haven't misunderstood you, I have made some modifications to your initial program.
Code:
struct node
{
int data;
int expn;
node *next;
}; <---- YOU NEED A SEMICOLON
//---------------------------------------------------------
node* input()
{
node *head, *curr;
int data, expn;
head=curr=NULL;
cout<<"Please input the datas:"<<endl;
cout<<"data: expn:"<<endl;
cin >> data >> expn; // <-- USED FOR INITIAL LOOP ENTRY
while((data!=0)&&(expn!=0))
{
if (head==NULL) // <--- USED ONLY THE FIRST TIME
{
head=new node;
head->data=data;
head->expn=expn;
head->next=NULL;
curr=head;
}
else // <-- ALL OTHER NODES WILL BE CREATED HERE
{
curr->next=new node;
curr=curr->next;
curr->data=data;
curr->expn=expn;
curr->next=NULL;
}
clrscr ();
cout << "Please input the datas: " << endl;
cout << "data: expn: " << endl;
cin >> data >> expn;
}
return head;
}
Hope this helps
Sophie