C++ 统计输入的句子有多少英文字母
2024-08-28 07:30:37
// ConsoleApplication1.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int countnubstr(string str)
{
int returnnum = 0;
for (int i = 0; i<str.length(); i++)
{
if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z'))
{
returnnum++;
}
}
return returnnum;
}
void main()
{
string str;
cout << "Please input English Line" << endl;
//流输入一串英文句子。
getline(cin,str);
cout << endl<< "There is " << countnubstr(str) << "noumber words int this English Line" << endl;
getchar();
}
最新文章
- Ionic2系列——Ionic 2 Guide 官方文档中文版
- haproxy的使用
- html5+js实现刮刮卡效果
- netsh命令
- Install SharePoint 2013 on Windows Server 2012 without a domain
- SQL Server -SET NOCOUNT
- 如何解决Windows8.1(32bit&;amp;64bit)下Cisco VPN Client拨号时报442错误的问题
- js原生设计模式——3简单工厂模式\js面向对象编程实例
- 关于lamp环境搭建过程的教程
- C# Aspose.Cells 如何设置单元格样式
- ifcfg命令
- Oracle,cast函数
- cell下载图片的思路 --无沙盒(内存)缓冲
- Raspbian安装Opencv3
- PHP跨页面传递时session失效
- [Ispc2009]Let there be rainbows!
- bzoj3672【NOI2014】购票
- “Hello World!”团队——Alpha发布用户使用报告
- shell 读配置文件
- Ubuntu 通过APT安装Tomcat
热门文章
- 【SaltStack官方版】—— STORING JOB RESULTS IN AN EXTERNAL SYSTEM
- 安装c#服务
- 对promise.all底层的实现的研究
- docker跨主机通信-overlay
- Codeforces 950C Zebras ( 贪心 &;&; 模拟 )
- antd form表单一行多个组件并对其校验
- Vue使用axios请求数据,默认post请求传参是json格式,但后台需要formData格式???
- 使用指定MTU到特定IP
- leetcode-mid-backtracking-17. Letter Combinations of a Phone Number
- EasyHook