#include <iostream>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
char kata[15];
int belakang;
bool palindrom = true;
cout<<"masukan kata : ";
cin.getline(kata, sizeof(kata));
int panjang = strlen(kata);
belakang = panjang-1;
for(int a=0;a<panjang;a++){
if((char)tolower(kata[a])!=(char)tolower(kata[belakang])){
palindrom = false;
break;
}
belakang--;
}
if(palindrom){
cout<<"termasuk palindrom";
cout<<endl;
}
else
cout<<" bukan palindrom";
return 0;
}
Output :