title: C Programming - Lotto Simulation
body: <p>I am making a program to simulate the lotto. The numbers can range between 1-45, but the numbers drawn must be unique. The program generates 6 random numbers in this range and adds them to an array. The user enters their numbers and the program checks if the 2 arrays are the same i.e whether they have won the lotto or not. </p>
  
  <p>I don't know why, but my program doesn't generate the random numbers, nor does it check if they're equal.</p>
  
  <pre><code>&gt; #include &lt;stdio.h&gt;
  &gt; #include &lt;stdlib.h&gt;
  &gt; 
  &gt; int main(int argc, const char * argv[]) {
  &gt;     // insert code here...
  &gt;     int lotto[6];
  &gt;     int i;
  &gt; 
  &gt;     int user[6];
  &gt;     for(i=0; i&lt;6; i++){
  &gt;         printf("Please enter a number between 1 and 45: \n");
  &gt;         scanf("%d", &amp;user[i]);
  &gt;     }
  &gt;     printf("User's numbers: \n");
  &gt;     for(i=0; i&lt;6; i++){
  &gt;         printf("%d \n", user[i]);
  &gt;     }
  &gt;     printf("Generate 6 Random Lotto Numbers \n");
  &gt;     
  &gt;     
  &gt;     for(i=0; i&lt;6;i++){
  &gt;          lotto[i] = rand() % 45 + 1;
  &gt;      }
  &gt;     for(i=0; i&lt;6; i++){
  &gt;         printf("%d \n",lotto[i]);
  &gt;      }
  &gt; 
  &gt;     
  &gt;     
  &gt;     
  &gt;      for(i=0; i&lt;6; i++){
  &gt;          if(lotto[i] != user[i]){
  &gt;              printf("Hard luck. Try again next time.");
  &gt;              break;
  &gt;          }
  &gt;          else{
  &gt;              printf("You've won the lotto!");
  &gt;          }
  &gt;      
  &gt;     }
  &gt;      return 0; }
  </code></pre>
  
  <p>Some typos in the code were pointed out to me. I also added a piece of code, but I am going to comment it because I am unsure if it's the right approach needed for what I want to do.</p>
  
  <p>Any help would be extremely helpful and I'd be even more grateful. :)</p>