Program Interatif :
#include <iostream>
#include <string>
using namespace std;
void balik(char *s)
{ int i;
for (i=strlen(s)-1; i>=0; i--)
cout << s[i];
}
main(){
char *kata = "Algoritma";
balik(kata);
return 0;
}
Program Rekursif :
#include <iostream>
#include <string>
using namespace std;
void balik(char *s)
{
if (*s != '\0') {
balik(&s[1]);
cout << s[0];
}
}
main() {
char *kata = "Algoritma";
balik(kata);
return 0;
}
Raptor :
Comments
Post a Comment