write program for palindrome

Answer Posted / pallavi attarde

#include<iostream.h>
#include<string.h>

int main()
{
char str[25],str1[25];
cout<<"Enter a string: ";

gets(str);

strcpy(str1,str);
strrev(str);
if(strcmp(str,str1)!=0)
{
cout<<"string is not palindrome";
}
else
{
cout<<"string is a palindrome";
}

cout<<endl;

Is This Answer Correct ?    596 Yes 248 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are enumerations?

657


What is the use of endl in c++ give an example?

614


What do you mean by global variables?

572


What is the difference between a declaration and a definition?

584


How do you remove an element from a set in c++?

582






What is a hashmap c++?

570


What is main function in c++ with example?

564


What is the outcome of cout< a) 16 b) 17 c) 16.5

627


What is the need of a destructor?

638


Why is c++ still best?

554


Difference between pointer to constant and constant pointer to a constant. Give example.

642


When should we use multiple inheritance?

617


What are the defining traits of an object-oriented language?

694


Which one is better- macro or function?

651


Is c++ a good first language to learn?

573