#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#define que_size 10
int front=-1;
int rear=-1;
char q[que_size];
void insert(char c)
{
if(rear==que_size-1)
{
printf("\n\nOverflow
Occurs!!");
getch();
return;
}
if(front==-1)
front=front+1;
rear =rear+1;
q[rear]=c;
}
void display()
{
int i;
if(front==-1)
{
printf("\n\nQueue is
empty !!");
}
else
{
printf("\n\nString
is : ");
for(i=front;i<=rear;i++)
{
printf("%c",q[i]);
}
}
}
void check()
{
int f;
while(front!=rear)
{
if(q[front]==q[rear])
{
f=1;
front++;
rear--;
}
else
{
f=0;
break;
}
}
if(f==1)
printf("\nString is a palindrome !!");
else
printf("\nString is not a palindrome!!");
}
void main()
{
int i;
char s[10];
clrscr();
printf("\nEnter string : ");
gets(s);
for(i=0;i<=strlen(s)-1;i++)
{
insert(s[i]);
}
if(rear!=que_size-1)
{
display();
check();
}
getch();
}
Output: