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
What is an iterator?
When do we run a shell in the unix system?
How one would use switch in a program?
Why is c++ difficult?
What is a constructor and how is it called?
what are the types of Member Functions?
How do I run c++?
What is the benefit of learning c++?
How do you compile the source code with your compiler?
What is function prototyping? What are its advantages?
How to declare a pointer to an array of integers?
Why null pointer is used?
When do we run a shell in the unix system? How will you tell which shell you are running?
What is late binding c++?
How can a called function determine the number of arguments that have been passed to it?