017
来源:互联网 发布:ubuntu安装git失败 编辑:程序博客网 时间:2024/06/05 19:59
题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
#include<iostream>#include<string>using namespace std;int main(){string line;int letters,digits,space,others;letters=digits=space=others=0;getline(cin,line);for(int i=0;i!=line.size();i++){if(line[i]>='a'&&line[i]<='z'||line[i]>='A'&&line[i]<='Z')letters++;elseif(line[i]==' ') space++; else if(line[i]>='0'&&line[i]<='9') digits++; else others++;}cout<<"字母:"<<letters<<endl;cout<<"数字:"<<digits<<endl;cout<<"空格:"<<space<<endl;cout<<"其他:"<<others<<endl;return 0;}
0 0
- 017
- 017
- 017
- 017-字符串
- 053-017
- leetcode016 017
- tapestry 017
- L1-017
- AGC 017
- Day 017
- [017]凤梨炒饭
- 017_《参透Delphi_Kylix》
- win32 017对话框
- LeetCode 017 4Sum
- 工作周报017
- 017java Object类
- 017 exit()函数
- 017_RotateAnimation 翻译学习
- 求高精度幂
- 关于vs2010输出界面闪烁一下就关闭的问题
- Qt-程序发布
- 读书笔记(1)
- STL vector中的emplace_back方法(24)
- 017
- Python String和PyQt QString的区别(转) http://blog.sina.com.cn/s/blog_4b5039210100h9kp.html
- WebView学习2
- 转载小满的
- Fragment嵌套Fragment的时候容易出现白屏的现象
- poj 1151 Atlantis “线段树维护关键值”+“离散化”+“扫描线法”
- C++获取系统时间
- 二维码,你真的了解吗?
- HOJ 12899 A+B Bucharest, Romania 2013