title: Result of calculation is not changed when one of the variables is updated later
body: <p>In the following code everything went fine except the last &quot;total of weapons&quot; that was not updated when I added +1 to the <code>numberPistols</code>. I understood that the <code>numberPistols</code> was updated but when using the <code>numberWeapons</code> on the last line it don't show the new value.</p>
  <p>I still cannot understand why, can somebody explain me and show me what I'm doing wrong?</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
      int numberPistols = 5;
      int numberKnives = 18;
      int numberWeapons = numberPistols + numberKnives;
  
      cout &lt;&lt; &quot;Number of Pistols: &quot; &lt;&lt; numberPistols &lt;&lt; endl;
      cout &lt;&lt; &quot;Number of Knives: &quot; &lt;&lt; numberKnives &lt;&lt; endl;
      cout &lt;&lt; &quot;Total of Weapons: &quot; &lt;&lt; numberPistols + numberKnives &lt;&lt; endl;
  
      cout &lt;&lt; &quot;There's a new Pistol available!&quot; &lt;&lt; endl;
  
      numberPistols = numberPistols + 1;
      cout &lt;&lt; &quot;New amount of Pistols &quot; &lt;&lt; numberPistols &lt;&lt; endl;
      cout &lt;&lt; &quot;Updated total of Weapons &quot; &lt;&lt; numberWeapons &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>