can someone correct the code for me ? because i got a little bit wrong answers of my program . . .Code:#include <iostream.h> #include <fstream> using namespace std; main() { char strn[80]; int i,j,len; ifstream myFile("input.txt"); while(myFile.getline(strn,80)){ cout<<strn<<endl; bool flag=false; len=strlen(strn); for(i=0,j=len-1;i<=(len/2);i++,j--) { if(strn[i]==strn[j]) flag=true; } if(flag) { cout<<"Palindrome"<<endl<<endl; } else { cout<<"Not a palindrome"<<endl<<endl; } } cout<<endl; system("pause"); }
the word from the .txt is
A car, a man, a maraca. =it is a palindrome
Palindromelist =it is not palindrome
Your Ad Here =it is not palindrome
A Toyota’s a Toyota. = palindrome
Animal loots foliated detail of stool lamina. =palindrome
Was it a cat I saw? = it is palindrome also
A word, phrase, verse, or sentence that reads the same backward or forward = not a palindrome
1001 = palindrome. .
but at my output of my program . . .
Your Ad here is a palindrome
A word, phrase, verse, or sentence that reads the same backward or forward = is a palindrome
and that 2 sentence must not be palindrome it must be not a palindrome
i got 2 wrong answer . ..plz i really need help . .



LinkBack URL
About LinkBacks


