^^It is a standard bulls and cows game. The computer selects a number. A 4 digit number. There are no repeated digits in the number. Each digit is unique.
here
Code:
This is a single player game. The computer selects a 4 digit number at random and then you have to guess that number. Remember that each digit in the number selected by the computer will be unique. Then when you enter your choice, the computer will give an output which will be telling you the total number of digits and positions of those which are correct.
Suppose the computer has selected the number 2156, and you enter your guess as 1234. Here the numbers 1 and 2 are correct. The positions of those numbers are, however, not correct. So the output will be:-
2 Numbers Correct.
0 Positions Correct.
Now if you enter 2134 then the output will be:-
2 Numbers Correct.
2 Positions Correct.
Now if you enter 2156 as your number, then all four numbers as well as their positions are correct, so the output will be:-
The number Selected By the computer was 2156