#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;
}