0
int getGuess()
{
    int number = 0;
    int  i = 0;
    printf("Enter your guess\n");
    for (i = 1; i<=FOUR;i++)
    {
        number = number*TEN + getche();
    }   
    printf("\n");
    return number;
}

I did this code, I know that this is a function but in the function that I called to this function I print the value, and it does not work as I expected. I this is what I enter 2431 and this the real value 55759. well how could I can get integer number and without press on enter?

1 Answers1

0

When you ask for input, the program stops. The system needs to know when the input stops and this is usually the enter key. When the input is provided, the program starts again. This is the default C behaviour. Professional developers write their own input driver to control this start/stop situation.

dev7060
  • 120
  • 8