views:

38

answers:

1
nodeType* buildSet()
{
   nodeType *first, *newNode, *last;
   first = NULL;

   int num = 0;
   string input = "";

   getline(cin,input);
   stringstream myStream(input);

   while(myStream >> num)
//   while(num != -999)   
   {      
      newNode = new nodeType;
      newNode->info = num;
      newNode->link = NULL;

      if(first == NULL)
      {
         first = newNode;
         last = newNode;
      }
      else
      {
         last->link = newNode;
         last = newNode;
      }
         getline(cin,input);      
//       cin >> num;  
   }

   return first;
}
A: 

I fixed the problem by deleting the second "getline(cin, input)".

Mike