please can someone give me the of this c++ question
Attachments:
Answers
Answered by
1
Answer:
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
bool isPalindrome(string str){
int len = str.length();
string rev;
for(int i = len-1; i >= 0; i--){
rev.push_back(str[i]);
}
if (rev == str){
return true;
}
return false;
}
int main() {
char str[100];
cout << "Enter a string:";
cin >> str;
if(isPalindrome(str)){
cout << str << " is a palindrome \n";
}
else{
cout << str << " is not a palindrome \n";
}
}
Explanation:
Similar questions
Science,
11 hours ago
Geography,
11 hours ago
Biology,
11 hours ago
India Languages,
22 hours ago
Social Sciences,
8 months ago
Political Science,
8 months ago