#include<iostream.h> #include<string.h> #include<conio.h> //---------------------------- palindrome -----------------------------// class palindrome { private: char word[25]; public: void get_value(); void show_value(); }; //--------------------------- get_value( ) ----------------------------// void palindrome::get_value() { cout<<\"\\n Enter the word : \"; cin.getline(word,25); } //-------------------------- show_value( ) ----------------------------// void palindrome::show_value() { char string[20]; int flag_1 =0; int count_1=0; int flag_2 ; int flag_3=0; while(word[count_1]!=\'\\0\') { flag_1 =flag_1 +1; count_1++; } flag_2 =flag_1 /2; for(int count_2=flag_1 -1,count_3=0;count_2>flag_2 ,count_3<=flag_2 ; count_2--,count_3++) string[count_3]=word[count_2]; for(int m=0;m<flag_2 ;m++) { if(string[m]==word[m]) flag_3=flag_3+1; } if(flag_3==flag_2 ) cout<<\"\\n\\t The word is Palindrome \"<<endl; else cout<<\"\\n\\t The word is not Palindrome\"<<endl; } //----------------------------- Main( ) -------------------------------// main( ) { clrscr(); palindrome s; char x; do { s.get_value(); s.show_value(); cout<<\"\\n Do you want to continue ( y/n )? : \"; cin>>x; } while(x==\'y\'); getch(); return 0; }