title: Simple Number Guessing Game. C++
body: <p>I've been trying to make a simple game where the computer generates a random number and you try to guess it. It also stores the amount of guesses you make "tries". </p>
  
  <p>However, when I run the program, it simply prints: "Let's play a game. I'll think of a number 1-100. Try to guess it."</p>
  
  <p>Here's my code: </p>
  
  <pre><code>    #include &lt;iostream&gt;
  
      int main()
  
      {
          using namespace std;
  
          int the_number;
          int guess;
          int tries;
  
          the_number = rand() % 101 + 1;
  
          cout &lt;&lt; "Let's play a game!";
          cout &lt;&lt; "I will think of a number 1-100. Try to guess it.";
          cout &lt;&lt; endl;
          cin &gt;&gt; guess;
  
          for (tries = 0; tries++;)
          {
              if (guess == the_number)
              {
                  cout &lt;&lt; "You guessed it!";
                  cout &lt;&lt; "And it only took you: " &lt;&lt; tries;
              }
              else if (guess &lt; the_number)
              {
                  cout &lt;&lt; "Higher";
                  tries++;
              }
  
  
              else if (guess &gt; the_number)
              {
                  cout &lt;&lt; "Lower";
                  tries++;
              }
  
              else
                  cout &lt;&lt; "That's not even in range!";
              return 0;
  
  
  
  
  
      }
  
  
  
  }
  </code></pre>
  
  <p>I don't understand why this doesn't work, could someone explain why not?</p>