title: Reversing alphabet value of individual characters in string by calculating the difference
body: <p>I'm trying to write a little function that will flip lowercase characters to their symmetric counterparts in the second half of the alphabet - 26 letters = 13/13. </p>
  
  <p>a = z, b = y, c = x...</p>
  
  <p>I've tried the following code but for some reason it works only for the first character.</p>
  
  <p>Say I enter "bamba"; it begins by switching the 'b' to 'y' but then it gets stuck and replaces all the other character to 'y' as well and I get "yyyyy".</p>
  
  <p>I tried playing around with the code a bit and discovered that if I remove dependency by the current character, I can safely increase all the letters by, say, 1 (a = b, b = c...)</p>
  
  <pre><code>symmetric_difference = 1; **commented out** //21 - toCrypt[i];
  </code></pre>
  
  <p>I looked all over and the closest thing I found was 
  "Reversing alphabet value of individual characters in string" but it describes a way that seems weird and redundant.</p>
  
  <p>Can anyone tell me what I did wrong please (assuming that I did)?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void crypto(char[]);
  
  int  main()
  {
      char toCrypt[80];
  
      cout &lt;&lt; "enter a string:\n";
      cin &gt;&gt; toCrypt;
  
      crypto(toCrypt);
  
      cout &lt;&lt; "after crypto:\n";
      cout &lt;&lt; toCrypt;
  }
  
  void crypto(char toCrypt[]) // "Folding" encryption.
  {
      int size = strlen(toCrypt);
      int symmetric_difference;
  
      for (int i = 0; i &lt; size; i++)
      {
          symmetric_difference = 121 - toCrypt[i];    // Calculate the difference the letter has from it's symmetric counterpart.
  
          if (toCrypt[i] &gt;= 97 &amp;&amp; toCrypt[i] &lt;= 110)  // If the letter is in the lower half on the alphabet,
              toCrypt[i] += symmetric_difference; // Increase it by the difference.
          else
          if (toCrypt[i] &gt;= 111 &amp;&amp; toCrypt[i] &lt;= 122) // If it's in the upper half,
              toCrypt[i] -= symmetric_difference; // decrease it by the difference.
      }
  }
  </code></pre>