1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #include "iostream" using namespace std; #include "conio.h" #include "string.h" class func { public: void pal(int ); void pal(char c[]); }; void func :: pal(int n) { int n1,sum,a; n1=n; sum=0; do { sum=sum*10; a=n%10; sum=sum+a; n=n/10; }while(n>0); if(sum==n1) cout<<"\n it is Palindrom"; else cout<<"\n it is not a palindrom"; } void func :: pal(char c[]) { int l=strlen(c); char b[10]; int i,j; for(i=0,j=l-1;i<l;i++,j–) { b[i]=c[j]; } b[i]=''; if(strcmp(c,b)==0) {cout<<"\nThe entered text is palindrome"; } else {cout<<"\n the entered text is not a palindrome"; } } int main() { char c[10]; int k,r,v; func p; do { cout<<"palindrome"<<endl; cout<<"1.for interger"<<endl; cout<<"2.for character"<<endl; cout<<"enter the choice\n"<<endl; cin>>r; switch(r) { case 1: cout<<"Enter the number"; cin>>k; p.pal(k); break; case 2: cout<<"\nEnter the string to be checked"<<endl; cin>>c; p.pal(c); break; } cout<<"\ndo you want to continue? (1/0)"<<endl; cin>>v; }while(v==1); getch(); } |
ADB commands for Android
Android
What are C Tokens?
C/C++
Least Recently Used Paging Algorithm
Advanced programs
First In First Out Page Replacement Algorithm
Simple programs
Java Program to find the IP address of the Machine
Basic Programs
Palindrome checking using function overloading
Advanced programs
Bet...
...
HI...i am the member of this site and recently registered with u..i am so happy ...
HI.. U did great work..i really appreciate it..and i would like to have this...
plz send the code...