/*
Copyright (c) 2014,烟台大学计算机学院
All rights reserved.
文件名称:test.cpp
作 者:张学伟
完成日期:2016年10月29日
版 本 号:v1.0
运算过程:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int alpha=0,number=0,space=0,others=0;
char ch;
while((ch=getchar())!='\n')
{
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
alpha++;
else if(ch>='0'&&ch<='9')
number++;
else if(ch==' ')
space++;
else
others++;
}
printf("%d %d %d %d\n",alpha,number,space,others);
return 0;
}
运行结果:
知识点总结:
识别字符。
学习心得:
当我打开oj题时脑袋都懵了不知道该从哪下手,一开始根本没有思路,到最后慢慢的有了思路。