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
How do you add an element to a set in c++?
Is java made in c++?
What are separators in c++?
Is dev c++ a good compiler?
What is the role of copy constructor in copying of thrown objects?
Which one between if-else and switch is more efficient?
What are pointer-to-members? Explain.
Write a function that swaps the values of two integers, using int* as the argument type?
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Why do we use classes in programming?
What does iomanip mean in c++?
Define a pdb file.
What is pointer to array in c++?
Who made c++?
How is static data member similar to a global variable?