assignment2.c
//Option 1: Read users lotto numbers

Option 1: Read users lotto numbers
Option 1 : Read users lotto numbers
void user_lotto_numbers(int *temp_array)
{
	int i = 0;
	int j = 0;
	int k = 0;
	int lotto_num = 1;
	int duplicate = 0;
	printf("Please enter your lottery numbers (They must be between 1 and 42 and you cannot repeat a number twice)\n\n");
	for(i=0; i<NUMUSER; i++)
	{
		printf("Please enter lotto number %d: ",lotto_num);
		scanf("%d",&*(temp_array+i));
		if(*(temp_array+i)<1 || *(temp_array+i)>42)
		{
			printf("Invalid number please try again\n");
			i--;
			lotto_num--;
		}
		else
		{
			for(j=1; j<=i; j++)
			{
				for(k=0; k<j; k++)
				{
					if(*(temp_array+j) == *(temp_array+k))
					{
						printf("%d is a duplicate value. Please try again\n", *(temp_array+i));
						i--;
						lotto_num--;
					}
				}
			}
		}
		lotto_num++;
		getchar();
	}
}
void user_lotto_numbers ( int * temp_array ) { int i = 0 ; int j = 0 ; int k = 0 ; int lotto_num = 1 ; int duplicate = 0 ; printf ( " \n \n " ) ; for ( i = 0 ; i < NUMUSER ; i ++ ) { printf ( " " , lotto_num ) ; scanf ( " " , & * ( temp_array + i ) ) ; if ( * ( temp_array + i ) < 1 || * ( temp_array + i ) > 42 ) { printf ( " \n " ) ; i -- ; lotto_num -- ; } else { for ( j = 1 ; j <= i ; j ++ ) { for ( k = 0 ; k < j ; k ++ ) { if ( * ( temp_array + j ) == * ( temp_array + k ) ) { printf ( " \n " , * ( temp_array + i ) ) ; i -- ; lotto_num -- ; } } } } lotto_num ++ ; getchar ( ) ; } }
Option 1: Read users lotto numbers
Option 1 : Read users lotto numbers
//for loop that allows user to enter each lotto number into an array
 //Ask user for lotto numbers and enter them into the array
 //Error Check to make sure number is between 1 and 42
 //End if
 //Error check to make sure number is not a duplicate
 //Outer loop gets initialized to 1 so we make sure that in the comparison that takes place in the inner loop we're always comparing the current value against a previous one
 //internal loop goes through all the previous entries
 //end if
 //end for
 //end for
 //end else
 //If there is no error the lotto number increases by 1 and the user enters their next number
 //Getchar stops looping if a string or character is entered
 //End for
