Algoritma :
- Start
- Cek huruf pertama hingga akhir huruf
- Cek kembali huruf dari terakhir hingga pertama dan tukar tempat
- Tampilkan kata balikan dari hasil penukaran huruf
- End
#include<iostream.h>
#include<conio.h>
void main()
{
char kata[20];
int x=0,s=0;
cout<<"\t*****************************\n";
cout<<"\t* *\n";
cout<<"\t* Program Membalik Kata *\n";
cout<<"\t* *\n";
cout<<"\t*****************************\n\n";
cout<<"Masukkan kata yang ingin dibalik ! [maks 20]\n";
cin>>kata;
while (kata[x]!='\0')
{
x++;
}
cout<<"\n";
cout<<s;
s=1>5 && 4<5;
cout<<"\nHasil pembalikan : ";
while (x!=0)
{
cout<<kata[x-1];
x--;
}
getch();
}
#include<conio.h>
void main()
{
char kata[20];
int x=0,s=0;
cout<<"\t*****************************\n";
cout<<"\t* *\n";
cout<<"\t* Program Membalik Kata *\n";
cout<<"\t* *\n";
cout<<"\t*****************************\n\n";
cout<<"Masukkan kata yang ingin dibalik ! [maks 20]\n";
cin>>kata;
while (kata[x]!='\0')
{
x++;
}
cout<<"\n";
cout<<s;
s=1>5 && 4<5;
cout<<"\nHasil pembalikan : ";
while (x!=0)
{
cout<<kata[x-1];
x--;
}
getch();
}
0 comments:
Speak up your mind
Tell us what you're thinking... !