编一个程序,从 string 对象中去掉标点符号。要求输入到程序的字符串必须含有标点符号,输出结果则是去掉标点符号后的 string 对象。
来源:互联网 发布:11月9日淘宝交易指数 编辑:程序博客网 时间:2024/05/17 00:56
#include <iostream>
#include <ctype.h>
#include <string>
using namespace std;
int main(void)
{
string sour_str,out_str;//sour_str为用户输入的字符串,out_str为去掉标点的字符串
cout<<"Please input a string:";//输入字符串
cin>>sour_str;
for(int index=0;index<sour_str.size();index++)
{
if(!ispunct(sour_str[index]))
out_str+=sour_str[index];
}
cout<<"Delete punctuation character of the: "<<sour_str<<" is "<<out_str<<endl;
return 0;
}
#include <ctype.h>
#include <string>
using namespace std;
int main(void)
{
string sour_str,out_str;//sour_str为用户输入的字符串,out_str为去掉标点的字符串
cout<<"Please input a string:";//输入字符串
cin>>sour_str;
for(int index=0;index<sour_str.size();index++)
{
if(!ispunct(sour_str[index]))
out_str+=sour_str[index];
}
cout<<"Delete punctuation character of the: "<<sour_str<<" is "<<out_str<<endl;
return 0;
}
0 0
- 编一个程序,从 string 对象中去掉标点符号。要求输入到程序的字符串必须含有标点符号,输出结果则是去掉标点符号后的 string 对象。
- string对象中去掉标点符号
- 从string对象中去掉标点符号
- 从string对象中去掉标点符号
- c_字符串_从string对象中去掉标点符号
- 【C++小程序】读入一个包含标点符号的字符串,将去掉标点符号之后的字符串输出
- 如何去掉string对象中的标点符号?
- 去掉string中的标点符号
- 读入一个包含标点符号的字符串,将去掉标点符号之后的字符串输出
- Exercice_3.10_去掉string对象中的标点符号
- C++语言中用程序实现读入一个包含标点符号的字符串,将标点符号去除后输出字符串剩余的部分
- 去掉文件的标点符号
- python 对string去掉标点符号
- python 对string去掉标点符号
- js 去掉字符串末尾的标点符号
- Python 小技巧:去掉字符串首尾附带的标点符号
- 去掉英文句子中重复出现的单词和标点符号
- 去掉字符串中的标点符号,以及特殊符号
- 滥用互联网思维是种病,得治
- 关于接口、抽象类的一题
- OpenMAX Call Sequences
- mvc 架构模式
- Nagios 里面监控MySQL 监控事务夯住
- 编一个程序,从 string 对象中去掉标点符号。要求输入到程序的字符串必须含有标点符号,输出结果则是去掉标点符号后的 string 对象。
- 移动互联网迅猛发展,手机信息安全隐患如何消除?
- C#源代码统计程序
- Android获取状态栏高度
- NYOJ 44【子串和】
- Oracle中insert into select和select into的区别
- 蓝桥杯 输入日期
- 国产ROM纷争升级 能否诞生终结者?
- hdu 5199 map水题