Answer to Question #21527 in C++ for cheng

Question #21527
1. Write a program to tell whether an input word is a palindrome.
1
Expert's answer
2013-01-28T12:28:54-0500
#include <string>
#include<iostream>

using namespace std;
&
int main (){
string q;
int t,k=0;

cout<<"Entet the word : ";
cin>>q;
t=q.size();
//t=strlen(q);
for(int i=0; i<t/2; i++){
& if(q[i]==q[t-i-1]){
k++;

& }
}
if(k==t/2)
cout<<"word is a palindrome\n\n";
else
cout<<"word is not a palindrome\n\n";
&
system("PAUSE"); &
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS