write program for palindrome

Answer Posted / md. irshad alam

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
clrscr();
int palind(char []);
int r;
char name[5];
cout<<"Enter a String...";
gets(name);
r=pal(name);
if(r==0)
{
cout<<"\n"<<"PALINDROME...";
}
else
{
cout<<"\n"<<"NOT A PALINDROME...";
}
getch();
}
int palind(char name[])
{
char *p,*t;
p=name;
t=name+strlen(name)-1;
while(*p)
{
if(*p != *t)
{
return(1);
}
p++;
t--;
}
return(0);
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstraction c++?

786


Is the declaration of a class its interface or its implementation?

940


What is a static element?

798


What is the use of vtable?

874


What apps are written in c++?

811


In a function declaration, what does extern mean?

822


What is implicit conversion/coercion in c++?

979


Keyword mean in declaration?

801


Why do we use vector in c++?

784


Explain terminate() function?

801


How can you link a c++ program to c functions?

848


Explain the use of virtual destructor?

826


What kind of jobs can I get with c++?

823


What is the output of the following program? Why?

824


How many keywords are used in c++?

770