62 548
Assignments Done
98,7%
Successfully Done
In June 2018

Answer to Question #21527 in C++ for cheng

Question #21527
1. Write a program to tell whether an input word is a palindrome.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions