head = new acmetype;//creating first node
fin>>head->pid;
currptr = head;//curr ptr pointing at head and first node is ready.
counter++;
while(fin){
nnptr= new acmetype;
fin>>nnptr->pid;
fin.getline(description, 25);
// fin.getline(acmetype.description[25]);
currptr->link = nnptr;
currptr = currptr->link;
if(fin.peek()=='\n')fin.ignore();//check for next character
counter++;
}//end of while
currptr->link= NULL;
currptr= NULL;
nnptr= NULL;
}//end of inputfn
//****************************************************************************
void printfn(acmetype *&head){
acmetype *currptr;
//print all data members
currptr = head;
while(currptr!=NULL){
cout<<currptr->pid<<endl;
currptr=currptr->link;
if(fin.peek()=='\n')fin.ignore();
}//end of while
|