KASUS 6.5
12.29
By
Unknown
KASUS 6
0
komentar
DEV C++ :
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int hasil;
int i;
char kata;
char panjang;
int j;
raptor_prompt_variable_zzyz ="Masukan Kata : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> kata;
panjang =kata;
i =1;
j =panjang;
hasil =0;
while (!(i>panjang && j<=i))
{
if (kata[i]==kata[j])
{
hasil =hasil+1;
}
else
{
}
i =i+1;
j =j-1;
}
if (hasil==panjang)
{
j =1;
while (!(j>panjang))
{
cout << kata(j) << endl;
j =j+1;
}
cout << "Ini adalah Palindrom" << endl; }
else
{
cout << "Bukan Palidrom" << endl; }
return 0;
}
RAPTOR :
0 komentar: