Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Use "?" Enter a string of characters at will. Finally, count the numbers of letters, numbers and other characters respectively. (input with scanf statement)
Use "?" Enter a string of characters at will. Finally, count the numbers of letters, numbers and other characters respectively. (input with scanf statement)
1, write the beginning # contains.

2. Enter a pair of braces {}, and then all the steps are carried out in them, defining plastic variables n 1, n2, n3, n4 and character variable c..

3. Control the input and judgment of the string through the loop (and the loop needs to add a set of braces).

4. use if statement to judge the type of character if(c >;; = ' a ' & amp& ampc & lt= ' z ' | | c & gt= ' A ' & amp& ampc & lt= ' Z '); n 1++; else if(c = = ' '); n2++; else if(c & gt; = ' 0 ' & amp& ampc & lt= ' 9 ')n3++; elsen 4++; .

5. Output the result printf ("English letters %d, spaces %d, numbers %d, other characters %d", n 1, n2, n3, n4); .

6. Then save it all, compile it and run it to see the results.