#include<iostream>
using namespace std;
int main()
{
int i,j,upper,lower,digit,space,other;
char text[3][80];
upper=lower=digit=space=other=0;
for(i=0;i<3;i++)
{
cout<<"请输入第"<<i+1<<"行(please input line):"<<endl;
gets(text[i]); //这是啥情况。
for(j=0;j<80&&text[i][j]!='\0';j++)
{
if(text[i][j]>='A'&&text[i][j]<='Z')
{
upper++;
}
else if(text[i][j]>='0'&&text[i][j]<='9')
{
digit++;
}
else if(text[i][j]>='a'&&text[i][j]<='z')
{
lower++;
}
else if(text[i][j]=' ')
{
space++;
}
else
{
other++;
}
}
}
cout<<"大写字母个数为:"<<upper<<endl
<<"小写字母个数为:"<<lower<<endl
<<"数字个数为:"<<digit<<endl
<<"空格个数为:"<<space<<endl
<<"其他字符个数为:"<<other<<endl;
return 0;
}
http://www.baidu-x.com/?q=c%2B%2B+gets()