Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Is there any plastic input instruction in C language without pressing Enter? It's urgent
Is there any plastic input instruction in C language without pressing Enter? It's urgent
The effect you want is that you can't judge the number of digits, and you can only enter 0~9.

You use char c = getch ();

Then int a = c-' 0 ';; For example, if you enter 8, then c='8', so c-'0'='8'-'0'=8.

Because the ASC code of the input number minus the ASC code of 0 is the corresponding number.