//#include "stdafx.h"//If the vc++6.0, with this line.
#include <string>
#include <iostream>
using namespace std;
int main(int argv,char *argc[]){
string s;
char ch;
int upp,low,dig,oth,i;
cout << "Input a string(Ctrl+'z' end)...\n";
while(cin.get(ch))
s+=ch;
for(upp=low=dig=oth=i=0;s[i];i++)
if(s[i]>='A' && s[i]<='Z')
upp++;
else if(s[i]>='a' && s[i]<='z')
low++;
else if(s[i]>='0' && s[i]<='9')
dig++;
else
oth++;
cout << "UPP:\t" << upp << "\nLOW:\t" << low << "\nDIG:\t" << dig << "\nOTH:\t" << oth << endl;
return 0;
}
è¿è¡æ ·ä¾ï¼
