title: converting from upper to lower case and vice-versa
body: <p>I am writing code to enter a string and convert all its uppercase letters to lowercase and vice versa:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  int main(){
       string s;
       cout&lt;&lt;"enter the string :"&lt;&lt;endl;
       cin&gt;&gt;s;
  
       for (int i=0;i&lt;s.length();i++){
          if ('a'&lt;=s[i] &amp;&amp; s[i]&lt;='z'){
             s[i]=char(((int)s[i])-32);
          }
  
          if ('A'&lt;=s[i] &amp;&amp; s[i]&lt;='Z'){
             s[i]=char(((int)s[i])+32);
          }
        }
  
       cout&lt;&lt;"modified string is  : "&lt;&lt;s&lt;&lt;endl;
       return 0;
  }
  </code></pre>
  
  <p>Problem is that it always returns string with all lower case letters and none of them is upper case. Why?</p>