title: Order of precedence in if statement C++
body: <p>I'm trying to design a construct that can check for errors in input, so I  wrote two boolean functions in a test program whose parameters are string references. I was hoping my if statement would evaluate the first function- changing part of word, then evaluate the second function- changing word again, and finally evaluate the &amp;&amp; to see whether print. My code won't run, however, and the error says that no operand matches the &lt;&lt; operator for cout, when I'm trying to output the code. My code is can explain better than I. Could someone please explain why this won't work? I'm using Visual Studio 2012.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  bool changeString1(string &amp;word){
      word[0]='a';
      return word[1]=='b';
  }
  
  bool changeString2(string &amp;word){
      word[2]='c';
      return word[3]=='d';
  }
  
  int main(){
      cout &lt;&lt; "hello" &lt;&lt; endl;
  
      string word("cbad");
      if(changeString1(word) &amp;&amp; changeString2(word)){
          cout &lt;&lt; word &lt;&lt; endl;
      }
      system("Pause");
      return 0;
  }
  </code></pre>