0
点赞
收藏
分享

微信扫一扫

从string对象中去掉标点符号

#include "test.h"


#include <cctype>

#include <iostream.h>



int main()


{


string str;


cin >>str;


string str1;


for (string::size_type st = 0; st != str.size(); st++)


{


if (!ispunct(str[st]))                                                    //如果不是标点,加到另一个字符串中


{


str1 += str[st];


}


}


cout << str1;


return 0;


}


举报

相关推荐

0 条评论