#include<stdio.h>#include<conio.h>main(){ int zimu=0,dight=0,space=0,other=0,i=0; char c; printf("Input string:"); while((c=getchar())!='\n') yj { if('A'<=c&&c<='Z'||'a'<=c&&c<='z') ++zimu; else if ((c<='9')&&(c>='0')) ++dight; else if (c==' ') ++space; else ++other; } printf("zimu:%d\ndight:%d\nspace:%d\nother:%d\n",zimu,dight,space,other); getch();}我用的软件是devcpp-4.9.9.2还有一种是#include<stdio.h>#include<conio.h>main(){ int zimu=0,dight=0,space=0,other=0,i=0; char *p,s[1000]; printf("Input string:"); while((s[i]=getchar())!='\n') i++; p=&s[0];/*p=s;*/ while(*p!='\n') { if('A'<=*p&&*p<='Z'||'a'<=*p&&*p<='z') ++zimu; else if ((*p<='9')&&(*p>='0')) ++dight; else if (*p==' ') ++space; else ++other; p++; } printf("zimu:%d\ndight:%d\nspace:%d\nother:%d\n",zimu,dight,space,other); getch();}