Algoritma Pemrograman
Program Pembalik kata C++Rekursif dan Iteratif
- C++ Iteratif
Raptor Iteratif
#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];
int bnyk;
cout<<"Kata awal : ";cin>>kata;
bnyk=strlen(kata);
cout<<"Kata setelah di balik : ";
for(bnyk=strlen(kata)-1;bnyk>=0;bnyk=bnyk-1){
cout<<kata[bnyk];
}
return 0;
}
Raptor Rekursif
EmoticonEmoticon