Ask a Teacher



write a c++ program to check whether a string is palindrome or not using class without using flag?

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{
clrscr();
char str[30],str1[30];
cout<<"ENTER THE WORD:";
gets(str);
strcpy(str1,str);
strrev(str);
if(strcmp(str,str1)==0)
cout<<"THE WORD IS PALINDROME";
else
cout<<"THE WORD IS NOT PALINDROME";
getch();
}


comments powered by Disqus