title: C program which accepts only integers 1-42 into array and they cannot repeat in function
body: <p>Develop a program that will play the Lotto game. The program should allow a user to 
  enter their 6 selected numbers and give them a set of options, each performing a 
  specific requirement. You must store the 6 numbers in a 1-Dimensional array. </p>
  
  <p>There are a number of requirements that your program must meet. Your program 
  must be modularised (i.e. use functions) and each task should be dealt in a separate 
  function. The program should display a simple menu to the user and each option in 
  the menu will be implemented by calling a separate function. You must use pointer 
  notation to access array elements - NOT subscripts </p>
  
  <p>The requirements are as follows (each implemented in a separate function): </p>
  
  <ol>
  <li>Read the 6 selected numbers from the keyboard. Perform any necessary 
  validation (error-checking) required (e.g. all numbers must be different, range 
  1-42, etc.). <strong><em>THIS IS THE PART WHICH I CANNOT DO</em></strong></li>
  <li>Display the contents of the 1-D array containing your lotto numbers that you 
  entered. </li>
  <li>Sort the contents of the array in increasing order (i.e. 1st element = smallest 
  number, 2nd element = 2nd smallest number, etc.). You may use any sorting 
  algorithm of your choice. </li>
  <li>Compare your chosen lotto numbers in the 1-D array with the following 
  winning numbers: </li>
  </ol>
  
  <p>1,3,5,7,9,11 - 42 (Bonus number) </p>
  
  <p>5 Display the frequency of the numbers entered each time the user enters a new <strong><em>AND I HAVE NO CLUE HOW TO EVEN START THIS</em></strong>
  set of numbers (without exiting the program) on the screen. For example, it 
  might display: </p>
  
  <p>number 1 has been selected x times 
  number 7 has been selected x times 
  number 28 has been selected x times
  etc., </p>
  
  <p>6 Exit program</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;malloc.h&gt;
  #include&lt;string.h&gt;
  #include &lt;stdlib.h&gt; 
  #define NUMBERS 6
  
   // Declare Prototype
   void getnumbers(int*);
   void displaynumbers(int*);
   void sortnumbers(int*);
   void comparenumbers(int*,int*);
   void frequencynumbers(int*);
   void exit();
   main()
   {
  
  
       int choice=0;
       int lotto_no[NUMBERS];
       int winning_no[NUMBERS]={1,3,5,7,9,11};
  
      do
      {   
          system("cls");
           printf("\n======================MAGIC Lotto======================");
           printf("\n\n\n--------------Use 1-6 to navigate the menu-------------");
           printf("\n\n\n1.Pick your 6 lucky numbers");
           printf("\n\n2.Disply your numbers");
           printf("\n\n3.Display your lucky numbers in increasing order");
           printf("\n\n4.Compare your numbers to see your prize!");
           printf("\n\n5.Frequency of the numbers entered each time");
           printf("\n\n6.Exit");
           printf("\n\n\n========================================================");
           printf("\n");
          scanf("%d",&amp;choice);
           system("cls");//Clears the menu from the screen while we selesc an option from the Menu 
  
          if (choice == 1)
          {
              getnumbers(lotto_no);
          }
          if (choice == 2)
          {
              displaynumbers(lotto_no);
          }
          if(choice == 3)
          {
              sortnumbers(lotto_no);
          }
          if(choice == 4)
          {
              comparenumbers(lotto_no,winning_no);
          }
          if(choice == 5)
          {
              frequencynumbers(lotto_no);
          }
          if(choice == 6)
          {
              exit();
          }
  
  
          flushall();
          getchar();
  
      }
  
  
  
      while(choice&gt;1 || choice&lt;7);
  } 
  void getnumbers(int *lotto_no)
  {
      int i;
      printf("Enter your numbers\n");
          for(i=0;i&lt;NUMBERS;i++)
          {
              scanf("%d", &amp;*(lotto_no+i) );
  
              if ( *(lotto_no+i) &gt;0 || *(lotto_no + i ) &lt;= 43 )
              { 
                  continue;
              }
  
              else
              {
                  printf(" Please enter a value in between 1 and 42");
                  scanf("%d", &amp;(*(lotto_no+i)));
              }
          }
  
  }
  
  void displaynumbers(int *lotto_num)
  {
      int i;
      printf("Your lucky numbers are as follow:\n");
      for(i=0;i&lt;NUMBERS;i++)
      {
          printf("%d ",*(lotto_num+i));
      }
  }
  
  void sortnumbers(int *lotto_num)
  {
      int i;
      int j;
      int temp;
  
      for(i=0;i&lt;NUMBERS;i++)
      {
          for(j=i;j&lt;NUMBERS;j++)
          {
              if(*(lotto_num+i) &gt; *(lotto_num+j))
              {
                  temp=*(lotto_num+i);
                  *(lotto_num+i)=*(lotto_num+j);
                  *(lotto_num+j)=temp;
              }
          }
      }
      printf("Your lucky numbers are as follow:\n");
      for(i=0;i&lt;NUMBERS;i++)
      {
          printf("%d ",lotto_num[i]);
      }
  }
  void comparenumbers(int *lotto_num,int *winning_num)
  {
  
      int i;
      int j;
      int c;
      int b;
      int g;
      c=0;
      b=42;
      g=0;
  
      for(i=0;i&lt;NUMBERS;i++)
      {
          for(j=0;j&lt;NUMBERS;j++)
          {
              if(*(lotto_num+i) == *(winning_num+j))
              {
                  c++;
              }
          }
      }
      for(i=0;i&lt;NUMBERS;i++)
      {
          if(*(lotto_num)==b)
          {
              g++;
          }
      }
  
      if(c==6)
      {
          printf("JACKPOT!!!");
      }
      if(c==5)
      {
          printf("HOLIDAY!!!");
      }
      if(c==4)
      {
          printf("NIGHT OUT!!!");
      }
      if(c==3&amp;&amp;g==1)
      {
          printf("CINEMA TICKET!!!");
      }
      if(c==4&amp;&amp;g==1)
      {
          printf("WEEKEND AWAY!!!");
      }
      if(c==5&amp;&amp;g==1)
      {
          printf("NEW CAR!!!");
      }
      if(c&lt;3)
      {
          printf("MAYBE NEXT TIME QQ :(");
      }
  
  }
  void frequencynumbers(int *lotto_num)
  {
  
  }
  
  void exit()
  {
      exit(0);
  }
  </code></pre>