Void main ()
{
char ch;
Int=0 c, d=0;
Printf (" please enter the characters \ n ");
While (1)
{
The scanf (" % c ", & amp; Ch);
If (ch=='? ')
break;
If (ch> 'a' & amp; & Ch<'z')
C + +;
Else if (ch> '0' & amp; & Ch<'9')
D++;
}
Printf (" % d, % d \ n ", c, d);
}
CodePudding user response:
In the window from the keyboard input string you will first enter the buffer, then the program from the buffer to readBecause the loop is done again, your cycle is read a char character at a time and then followed by three conditional statement judgment
You can also try to use the compiler debugging to step through to see why is a one character at a time