#include"stdio.h"voidMain () {//definition string, I receive string variable j loop condition variable z Total number of S number F symbol total Chari[ -]; intj,z=0, s=0, f=0; printf ("Please enter a string:"); scanf ("%s",&i); for(j=0; J<=strlen (i); j + +)//strlen (i) calculates the total length of characters typed, compared with J as a cyclic condition{printf ("%c", I[j]); if(i[j]>='a'&&i[j]<='Z'|| i[j]>='A'&&i[j]<='Z')//determine the number of the letter condition ASCLL table corresponding to{z++; } Else if(i[j]>='0'&&i[j]<='9')//judging the numerical conditions{s++; }Else
if((i[j]>='!'&&i[j]<='/')|| (i[j]>=':'&&i[j]<='@')|| (i[j]>= the&&i[j]<= the)|| (i[j]>='{'&&i[j]<='~')) //determine the number of special symbol conditions ASCLL table corresponding{f++; }} printf ("\ n Letter:%d\n", z);//Output Calculation Resultsprintf"numbers:%d\n", s); printf ("symbol:%d\n", F); }
Outputs the number of letters, numbers, and special characters, based on the input string, respectively