The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Reverse String
By iliasand on 14th May 2019 05:57:06 PM | Syntax: CPP | Views: 3



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string reverse_String(string text,int size_text){
  6.     if (size_text == -1)
  7.         return "";
  8.     else
  9.     {
  10.         char a;
  11.         a = text[size_text];
  12.         return a + reverse_String(text, size_text - 1);
  13.     }
  14. }
  15.  
  16.  
  17. int main()
  18. {
  19.     /*
  20.      * function reverse string miad string migire bar ax mikone va return mikone
  21.      * besiar sade hast karesh
  22.      * dar variable ..a.. miad akharin harf ro mirize
  23.      * shart payani ham vazeh hast , size_text hamon a.size() hastesh ke hey -1 mishe
  24.      *
  25.      * in func yek rah baraye reverse kardan hast , va rahaye digar ham darad
  26.      */
  27.  
  28.  
  29.     string text = "TXET yM";
  30.     cout << reverse_String(text, text.size()) << endl;
  31.     system("pause");
  32. }



  • Recent Pastes
  • Fdsfd
    43 mins 52 secs ago
  • Sdfsdf s
    44 mins 48 secs ago
  • Surung
    1 hour 28 secs ago
  • Cozy
    1 hour 2 mins 53 secs ago
  • V4a
    1 hour 10 mins ago