fork download
  1. /* Reversing a string */
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. void reverseString(string in_str);
  7.  
  8. int main() {
  9. string str1 = "Hello World!";
  10. string str2 = "racecar";
  11. string str3 = "a man a plan a canal-panama";
  12. string str4 = " ";
  13.  
  14. reverseString(str1); cout << endl;
  15. reverseString(str2); cout << endl;
  16. reverseString(str3); cout << endl;
  17. reverseString(str4);
  18.  
  19. return 0;
  20. }
  21.  
  22. void reverseString(string in_str) {
  23.  
  24. int i = 0;
  25.  
  26. for(i = - 1; i >= 0; --i){
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout