#include <iostream> #include <cstring> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { char a[10000]; gets(a); int n=strlen(a); int EN=0; //英文 int NE=0; // 数字 for(int i=0;i<n;i++){ if(a[i]>='A'&&a[i]<='Z'){ EN++; }else if(a[i]>='a'&&a[i]<='z'){ EN++; } if(a[i]>='0'&&a[i]<='9'){ NE++; } } cout<<"英文:"<<EN<<"\n"; cout<<"数字:"<<NE<<"\n"; cout<<"其它:"<<n-NE-EN<<"\n"; return 0; }