hi;
this for circular link list type , its to check whether a word is palindrom or not .
it dosen't work !
can you check it
this the insert function :
void InsertLast(const elemtype &Item)
{
Node <elemtype>*temp;
temp=new Node<elemtype>;
if ( temp==NULL)
{
cout<<"Full memory"<<endl;
return;
}
temp -> info=Item;
temp ->next=NULL;
if (isEmpty())
{
first=temp;
last=temp;
}
else
{
last->next=temp;
last=temp;
}
count++;
}
and this is the function Palindrom and the main :
bool IsPalindram( )
{
Node <elemtype>*cur1, *cur2;
bool found = true;
cur1= first;
cur2= last;
for (int i =0; i<(count/2) ; i++)
{
if ( cur1->info == cur2->info)
{
cur1= cur1->next;
cur2=cur2->back;
found = true;
}
else
{
return ( found = false );
break;
}
return found ;
}
}
};
void main ()
{
CircularLinkedListType<*char> List;
*char x;
cout<<" Enter the list "<<endl;
cin>>x;
List.InsertLast(x);
List.print();
cout<<endl<<endl;
List.IsPalindram();
return;
}