title: c++ random number generator that allows user to choose range
body: <p>I have to come up with a random number generator where it will generate 5 random numbers that are within a range of two number entered by the user.  Example:  User first enters 1 then 10. Random numbers generated could be 2,3,4,5,8.  I can get it to give me 1 random number 5 times, but not 5 different random numbers.  Please see below.  Any help is appreciated.  Thanks!</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  using namespace std;
  
  int main ()
  {
          int num1, num2, randNum, seed;
  
  
          cout &lt;&lt; "enter number 1.\n";
          cin &gt;&gt; num1;
          cout &lt;&lt; "enter number 2.\n";
          cin &gt;&gt; num2;
  
  seed = num1 - num2;
  randNum = rand() % seed + 1;
  
          cout &lt;&lt; randNum &lt;&lt; "\n";
          cout &lt;&lt; randNum &lt;&lt; "\n";
          cout &lt;&lt; randNum &lt;&lt; "\n";
          cout &lt;&lt; randNum &lt;&lt; "\n";
          cout &lt;&lt; randNum &lt;&lt; "\n";
  
  return 0;
  }
  </code></pre>