c++中有没有较快的方法除掉一个文本中的标点符号

2025-04-27 02:27:59
推荐回答(1个)
回答1:

//#include "stdafx.h"//vc++6.0加上这一行.
#include
#include
using namespace std;
int main(void){
string str;
cout << "Enter a string...\nstr=";
getline(cin,str);
for(int ln=str.length(),i=0;i if(isalnum(str[i]))
cout << str[i];
cout << endl;
return 0;
}