I was starting off with making the game " Cows and Bulls".
And to start off i am having a problem in inputting the 4 digit number in a mannar that it appears in form of "*" on the screen. similar to a password.
And each digit should be separately inputted. Similar to the following...
int num[4],i=0;
printf("\nEnter the four digit no. : ");
for(i=0;i<4;i++)
{
scanf("%d",&num[i];
}
the problem with code is that :
1. The 4 digit no. should be inputted without a pause.
2. The digit should not be displayed on the screen.
So i tried this...
char a;
int num[4];
printf("\nEnter the four digit no. : ");
for(i=0;i<4;i++)
{
a=getch();
printf("*");
sscanf(a,"%d",num[i]);
}
Whts the problem with this code? How do i convert the string character into a number?