hey guys. i really need ur help. how do i program a guessing game with this following requirements??
Write a 3-digit number-guessing game based on the requirements below:
•Each digit of the number cannot be repeated
•The first digit can start with 0
•If the number entered by the user has repeating digits, the user has to be asked to re-enter a new number
•Each attempt of guessing need to be numbered
•The user will be told how many digits correctly positioned and how many digits wrongly positioned after each guess
•The user will be congratulated if the user successfully guessed the number.
•The user will be asked whether to replay or not at the end of the game
int main (void)
{
int play_again;
int guess;
int result[3];
int i;
int r_num;
srand (time (NULL));
r_num = 9 + 1;
play_again=0;
for (i = 0; i < 3; i++)
{
result[i] = rand( ) % 3 + 1;
}
do
{
guess=0;
do
{
printf("Hey am thinkin of a number!! Wanna guess?? ;) \n");
scanf("%d", &guess);
if (guess != r_num)
{
printf("Wrong answer!!\n");
}
else
{
printf("Correct answer!!\n");
}
guess++;
}
while (r_num != guess);
printf("The correct answer is %d\n", rand () % r_num);
printf("Do you wish to play again?? (Y/N)");
scanf("%c", &play_again);
}
while (play_again== 'y'||play_again=='Y');
well the issue is i dun noe hw i do i make the program tell the user on what are the correct and wrong positions.... am very very new to c++ programming... :)