I am attempting a deal or no deal game for a class. I have everything working, except for if the player wishes to review the remaining cash prizes.
To start i have 2 arrays. One containing the prize values, and the other being the cases (filled at random with values from the prize array).
I cannot display the remaining prizes directly from the cases array, as that would show what cases had what value. Instead, i must display them in increasing value, so as to hide their true order.
Whenever i "open" a case the value is set to 0 in the cases array, but the prizes array is never changed. The problem is that if i open a case, this following function just outputs a blank line. What is wrong?
Code:
int prizelook (int cases[], int prizes[], int arraylength){
int sentinal = 0;
int i = 0;
int j = 0;
for (i=0; i<SIZE; i++){
sentinal = 0;
j = 0;
while (sentinal==0){
if (cases[j]!=0){
if(prizes[i]==cases[j]){
printf("$%d ", cases[j]);
sentinal++;
}
else{
j++;
}
}
else{
sentinal++;
}
}
}
}