fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <string.h>
  4. using namespace std;
  5.  
  6. void reverseText(char * text)
  7. {
  8. char *kopia = text;
  9. char przedOdwr[100]; int dlugosc = 0;
  10.  
  11. for (int i = 0; *text != '\0'; i++) {
  12. przedOdwr[i] = *text;
  13. text++;
  14. dlugosc++;
  15. }
  16.  
  17. int j = 0;
  18. text = kopia;
  19.  
  20. for (int i = dlugosc - 1; i >= 0; i--) {
  21. *(text + j) = przedOdwr[i];
  22. j++;
  23. }
  24. }
  25.  
  26. int main()
  27. {
  28. char text[128];
  29. cin >> text;
  30. reverseText( text);
  31. cout<<text;
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 3460KB
stdin
kajak
stdout
kajak