Algoritma Pemrograman
#include <iostream>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
char kata[100];
cout<<"Masukan Kata : ";
cin>>kata;
int i,pj;
pj=strlen(kata);
for(i=0;i<=pj/2;i++)
if(kata[i]!=kata[pj-i-1]){
cout << " Non Palindrom" ;
i=pj;}
else {
cout<< " Palindrom ";i=pj;}
return 0;
}
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
char kata[100];
cout<<"Masukan Kata : ";
cin>>kata;
int i,pj;
pj=strlen(kata);
for(i=0;i<=pj/2;i++)
if(kata[i]!=kata[pj-i-1]){
cout << " Non Palindrom" ;
i=pj;}
else {
cout<< " Palindrom ";i=pj;}
return 0;
}
EmoticonEmoticon