title: Generating a random number generator for a guessing game
body: <p>This program is a high-low guessing game where a random number is generated and the user has 6 attempts to guess the number. I only copied my main function and the definition of the DrawNum and GetGuess functions, will post more if asked/needed. My goal is to have the DrawNum function return the random number and call the DrawNum function in the GetGuess function (if that is even the most efficient way of doing it). The function builds fine, but when I run the program I get Run-Time Check Failure #3 - the variable 'MaxNum' is being used without being initialized.</p>
  
  <pre><code>int main ()
  {
      int money;
      int bet;
      int guesses;
      unsigned int seed = 0;
  
      srand(static_cast&lt;unsigned&gt;(time(NULL)));   //get a value for the time from the     computer's clock and with
      srand (seed);                               //it calls     srand to initialize "seed" for the rand() function
  
      PrintHeading ();                            //Prints output heading
      GetBet (money, bet);
      GetGuess ();
      CalcNewMoney (money, bet, guesses);
      bool PlayAgain ();
  
  }
  int DrawNum (int max)
  {
      double x = RAND_MAX + 1.0;      /* x and y are both auxiliary */
      int y;                          /* variables used to    do the */
                                      /* calculation */
  
      y = static_cast&lt;int&gt; (1 + rand() * (max / x));
      return (y);                     /* y contains the result */
  }
  
  int GetGuess ()
  {
      int guess;          //user's guess
      int guesses;    //number of Guesses
      int MaxNum;
      int RandNum;
  
      RandNum = DrawNum (MaxNum);
  
      for (int guesses = 1; guesses &lt;= 6; guesses++)
      {
          cout &lt;&lt; "Guess " &lt;&lt; guesses &lt;&lt;  ":" &lt;&lt; endl;
          cin &gt;&gt; guess;
          if (guess &gt; RandNum)
          {
              cout &lt;&lt; "Too high... " &lt;&lt;endl;
          }
          else if (guess == RandNum)
          {
              cout &lt;&lt; "Correct!" &lt;&lt; endl;
          }
          else
          {
              cout &lt;&lt; "Too low... " &lt;&lt; endl; 
          }
      }
      return (guesses);
  }
  </code></pre>