#include<stdio.h>
void game(int round, int *guess_number, int *player_number, char *status) {
if(guess_number<player_number&&round<=1)
printf("Try a smaller number.\n");
else if(guess_number>player_number&&round<=1)
printf("Try a bigger number.\n");
else if(guess_number==player_number)
status='W';
else
status='L';
}
int main() {
int i,g_number=45,p_number,status;
for(i=0;i<=2;i++) {
do {
printf("Enter a number between 0 to 100:");
scanf("%d",&p_number);
} while(p_number<0||p_number>100);
game(i,&g_number,&p_number,&status);
}
return 0;
}
I am waiting for it to guess the number and equalize the status to W if the number is correct, and if it is incorrect, it will give a hint along with the right to try 2. If the last attempt is also wrong, it must be status='L'.