第13周项目 5.1 字符串操作
来源:互联网 发布:ae软件下载 编辑:程序博客网 时间:2024/05/16 15:19
* copyright (c) 2014 , 烟台大学计算机学院
* all rights reserved .
* 文件名称 : textst . cpp
* 作者 : 孙旭明
* 完成日期 : 2014年12月8日
* 版本号 : v1.0
*
* 问题描述 :
* 程序输出 :
*/ #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char str[50]; //定义一个可以接受50个字符的数组
int i=0,n=0;
cout<<"输入字符串:"<<endl;;
gets(str);
while(str[i]!='\0')
{
if(str[i]=='A')
{
n++;
}
i++;
}
cout<<"其中的字母“A”出现的次数是: "<<n<<endl;
return 0;
}
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char str[50]; //定义一个可以接受50个字符的数组
int i,m,n;
i=m=n=0;
cout<<"输入字符串:"<<endl;;
gets(str);
while(str[i]!='\0')
{
if(str[i]>='A'&&str[i]<='Z') //统计字符串中大写字母的个数
{
m++;
}
if(str[i]>='a'&&str[i]<='z') //统计字符串中小写字母的个数
{
n++;
}
i++;
}
cout<<"字符串中大写字母的个数是: "<<m<<endl;
cout<<"字符串中小写字母的个数是: "<<n<<endl;
return 0;
}
- 第13周项目 5.1 字符串操作
- 第13周项目5--字符串操作
- 第13周项目5-字符串操作
- 第13周项目5-字符串操作--字符串复制
- 第13周项目5(1-1)-字符串操作
- 第13周项目5(1-2)-字符串操作
- 第13周项目5(1-3)-字符串操作
- 第13周项目5(1-4)-字符串操作
- 第13周项目5(2-1)-字符串操作
- 第13周项目5(2-2)-字符串操作
- 第13周项目5(2-3)-字符串操作
- 第13周项目5(2-4)-字符串操作
- 第13周项目5-字符串操作(1.2)
- 第13周项目5-字符串操作(2.1)
- 第13周项目5-字符串操作(2.3)
- 第13周项目5-字符串操作(2.2)
- 第13周项目5-字符串操作(2.4)
- 第13周项目5 -字符串操作(1)
- 僵尸进程与孤儿进程学习
- 输入层数打印金字塔
- 抢票助手-for 12306买火车票.订票助手.高铁.动车.春运.车票管家.自动刷票.列车时刻表
- 转技巧
- HBase源码解析(一) HMaster启动流程
- 第13周项目 5.1 字符串操作
- SymmetricDS文档翻译--【Chapter 2. 配置(Setup)】
- 0101 什么是java future模式【转载】
- ch8.文件上传
- 恩布企业 IM 安卓端 1.1 发布,全新UI界面
- kmp
- Hadoop RPC热身之Java 反射
- [Elasticsearch] 多字段搜索 (一) - 多个及单个查询字符串
- 使用指针的指针输出字符串