#include "stdafx.h"
#include "iostream.h"
#include "string.h"
int i=0,Ul=0,Ll=0,space=0,d=0,other=0;
void Read_file(char *filename)
{
char*p,s[30];
FILE *fp;
while(s[i]!='\0')
{
*p=s[i];
i++;
if(('A'<=*p)&&(*p<='Z'))
Ul++;
else if(('a'<=*p)&&(*p<='z'))
Ll++;
else if(('0'<=*p)&&(*p<='9'))
d++;
else if(*p==' ')
space++;
else
other++;
}
cout<<"大写字母:"<<Ul<<endl;
cout<<"小写字母:"<Ll<<endl;
cout<<"数字:"<<d<<endl;
cout<<"空格:"<<space<<endl;
cout<<"其它符号:"<<other<<endl;
fclose(fp);
}
int main(int argc, char* argv[])
{
Read_file("d:\\作业.txt");
return 0;
}
不错但看不懂哈哈