Advertisement
triclops200

my way

Nov 10th, 2011
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. string s (string test)
  7. {
  8. int a=strlen(test.c_str())-1;
  9. string reversedstring = "";
  10. while (a >= 0)
  11. {
  12. reversedstring += test[a];
  13. a--;
  14. }
  15. return reversedstring;
  16. }
  17.  
  18.  
  19. int main(){
  20. cout<<s("hello!")<<endl;
  21. }
  22.  
  23.  
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement