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 an iterator?

684


When do we run a shell in the unix system?

558


How one would use switch in a program?

611


Why is c++ difficult?

600


What is a constructor and how is it called?

589






what are the types of Member Functions?

607


How do I run c++?

570


What is the benefit of learning c++?

545


How do you compile the source code with your compiler?

611


What is function prototyping? What are its advantages?

587


How to declare a pointer to an array of integers?

641


Why null pointer is used?

577


When do we run a shell in the unix system? How will you tell which shell you are running?

552


What is late binding c++?

537


How can a called function determine the number of arguments that have been passed to it?

655