I need help with this problem, please write the program in a detail manner in or
ID: 3544012 • Letter: I
Question
I need help with this problem, please write the program in a detail manner in order to get all the points...
Write a program in C++ to determine whether a word or number is palindrome. A word or number is palindrome when read from left to right means the same as from right to left.
Example:
Type a word or number: successful
successful is [NOT] a palindrome word
Do you wish to continue? (1) Yes or (0) No; 1
Type a word or number: 1001
1001 is a palindrome number
Do you wish to continue? (1) Yes or (0) No; 0
Bye Bye !!
I need help with this problem, please write the program in a detail manner in order to get all the points... Write a program in C++ to determine whether a word or number is palindrome. A word or number is palindrome when read from left to right means the same as from right to left. Example: Type a word or number: successful successful is [NOT] a palindrome word Do you wish to continue? (1) Yes or (0) No; 1 Type a word or number: 1001 1001 is a palindrome number Do you wish to continue? (1) Yes or (0) No; 0 Bye Bye !!Explanation / Answer
#include <iostream>
#include <string>
using namespace std;
int main()
{
char str[100];
cout << "Enter word :";
cin >> str;
int x = strlen(str)-1;
for(int i = 0; i <= x; i++)
{
if (str[i] == str[x-i])
{
continue;
}
else
{
cout<<"Not a palidrome"<<endl;
return 0;
}
}
cout << "Indeed Palidrome"<<endl;
return 0;
}