title: dice rolling game in C - counting wins and losses
body: <p>For this dice rolling game, I am supposed to count wins and losses rolling two dices at once.</p>
  <p>If the sum of the two dice is 7 on the first roll then the player wins.
  If the first roll is not 7, then the play continues to run until it rolls a number the same as the first roll, then the player wins.
  If the player does not have a 7 on a first roll but gets 7 before matching the first roll, then the player loses.</p>
  <p>The player plays 1000 games and count the wins and losses.</p>
  <p>I am not entirely sure of the logic of this programming assignment, but my code execute and returns 0s for both wins and losses.</p>
  <p>Can anyone please tell me what went wrong with the code?</p>
  <pre><code>
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  int rolldice()
  {
      int num[1000], wins, losses;
      
      srand(time(NULL));
      
      for (int i = 0; i &lt; 1000; i++)
      {
          int dice1 = (rand() % 6) + 1;
          int dice2 = (rand() % 6) + 1;
          
          num[i] = dice1 + dice2;
  
          if (num[0] == 7)
          {
              wins++;
          }
          
          if (num[0] != 7 &amp;&amp; num[i] == num[0])
          {
              wins++;
          }
          if (num[0] != 7 &amp;&amp; num[i] == 7)
          {
              losses++;
          }
      return wins, losses;        
      }
      
  
      
  }   
      
  
  
  int main()
  {
      int wins, losses;
      rolldice();
      printf(&quot;wins: %d \nlosses: %d&quot;, wins, losses);
      
      
  }
  </code></pre>