fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <set>
  5. #include <map>
  6. #include <sstream>
  7.  
  8. using namespace std;
  9. string Reverse(char * word)
  10. {
  11.  
  12. char * end = word;
  13. while(*end)
  14. ++end;
  15. --end;
  16.  
  17. char tem;
  18. while(word < end) {
  19. tem = *word;
  20. *word = *end;
  21. *end = tem;
  22.  
  23. ++word;
  24. --end;
  25. }
  26.  
  27. return end;
  28. }
  29.  
  30. int main(int argc, char * argv[]){
  31.  
  32. string s = Reverse("piegh");
  33.  
  34. cout << s << endl;
  35. return 0;
  36. }
Runtime error #stdin #stdout 0s 2892KB
stdin
Standard input is empty
stdout
Standard output is empty