title: C++: Reverse Strings within an array. Swap strings between two different arrays
body: <p>I've written the backbone for this code. I just needed a little insight on how i would complete the functions. i figure that <code>a.swap(b)</code> would work for swaping two strings within the same array. Am i wrong? </p>
  
  <p>Any insight/ suggestions are appreciated.</p>
  
  <pre><code>#include &lt;string&gt;
  using std::string;
  #include &lt;iostream&gt;
  #include &lt;cassert&gt;
  
  using namespace std;
  
  void swap(string &amp; a, string &amp; b); // swaps two strings.
  void reverse_arr(string a1[], int n1); // reverse an array of strings.
  void swap_arr(string a1[], int n1, string a2[], int n2); // swaps two arrays of strings.
  
  int main(){
    string futurama[] = { “fry”, “bender”, “leela”, 
                          “professor farnsworth”, “amy”, 
                          “doctor zoidberg”, “hermes”, “zapp brannigan”, 
                          “kif”, “mom” };
  
    for (int i=0;i&lt;10;i++)
      cout &lt;&lt; futurama[i] &lt;&lt; endl;
  
    swap(futurama[0],futurama[1]);
    cout &lt;&lt; “After swap(futurama[0],futurama[1]);” &lt;&lt; endl;
  
    for (int i=0;i&lt;10;i++)
      cout &lt;&lt; futurama[i] &lt;&lt; endl;
  
    reverse_arr(futurama,10);
    cout &lt;&lt; “After reverse_arr(futurama,10);” &lt;&lt; endl;
  
    for (int i=0;i&lt;10;i++)
      cout &lt;&lt; futurama[i] &lt;&lt; endl;
  
    // declare another array of strings and then 
    // swap_arr(string a1[], int n1, string a2[], int n2);
  
    char w;
    cout &lt;&lt; “Enter q to exit.” &lt;&lt; endl;
    cin &gt;&gt; w;
    return 0;
  }
  
  void swap(string &amp; a, string &amp; b){
    // swaps two strings.
    a.swap(b);
  }
  
  void reverse_arr(string a1[], int n1) {
  
  // Reverse an array of strings.
  
  }
  
  void swap_arr(string a1[], int n1, string a2[], int n2) {
  
  // swaps two arrays of strings.
  
  }
  </code></pre>