// **************************************************** //
// The grab function for CHAR_SLLIST class //
// **************************************************** //
istream& CHAR_SLLIST::grab(istream& input)
{
CHAR_SL_CELL *temp;
CHAR c,test;
int i;
cout << "Please Enter the element which terminates input:" << endl;
cin >> test;
//see if list is empty but built
if(head==NULL){
head = new CHAR_SL_CELL(name);
input >> c;
if(!(c==test)){
head->element = c;
}
}
//find end of list
temp = head;
while(!(temp->next==NULL))
temp = temp->next;
//temp is not NULL
input >> c;
while(!(c==test)){
temp->next = new CHAR_SL_CELL(name);
temp->next->element = c;
temp = temp->next;
input >> c;
}
return input;
}
// **************************************************** //
// The print function for CHAR_SLLIST class //
// **************************************************** //
ostream& CHAR_SLLIST::print(ostream& output) const
{
CHAR_SL_CELL *temp;
temp = head;
while(!(temp==NULL)){
output << *temp;
temp = temp->next;
}
return(output);
}