I am having trouble with a guessing game assignment. We are to create a game where the player guesses the correct sequence of 5 numbers (1-5). The game compares the sequence entered by the player to the randomly generated sequence of numbers stored in a single dimensional array. My problem is how to compare the entered numbers to the generated numbers. Here is what I have so far:
Code:
#include<stdio.h>
#include<stdlib.h>
#define SIZE 5
int main(){
int index;
int array[SIZE];
printf("Game: Who's Next? \n");
printf("Objective: Identify the Sequence of 5 numbers between 1 and 5 using the fewest \n");
printf("turns. If you wish to quit guessing and give up, enter a ZERO for one of your \n");
printf("guesses and the game will display the solution and quit. \n");
printf("GOOD LUCK!\n");
srand(time(NULL));
for(index=0;index<SIZE;index++){
array[index] = rand() % 5 + 1;
}
printf("Game Number Sequence \n");
printf("--------------------- \n");
printf("| %d | %d | %d | %d | %d | \n",array[0],array[1],array[2],array[3],array[4]);
printf("--------------------- \n");
return 0;
}
I just can't figure out what to put in the middle of the body to get the comparison