title: Char swap in a file C++
body: <p>I dont know why this will not work, i need to swap the two chars enterd as a and b, it compiles but all the chars are replaced with the char inputted as b, any advise?</p>
  
  <pre><code>while (n != exist)
  {
      cout&lt;&lt;"What is the letter you want to swap?"&lt;&lt;endl;
      cin&gt;&gt;a;             
      cout&lt;&lt;"What is the letter you want to swap it with?"&lt;&lt;endl;
      cin&gt;&gt;b;
      if (inFile.is_open())
      {
          while (inFile.good())
          {   
              inFile.get(c);
              if( c = a )
              {
                  outFile&lt;&lt; b;
              }
              else if (c = b)
              {
                  outFile&lt;&lt; a;
              }
              else
              {
                  outFile&lt;&lt; c;
              }                               
          }                           
      }
      else
      {
          cout&lt;&lt;"Please run the decrypt."&lt;&lt;endl;
      }
      cout&lt;&lt;"Another letter? &lt;n&gt; to stop swapping"&lt;&lt;endl;
      cin&gt;&gt;n;
  }               
  </code></pre>