#include <iostream>
#include <string>
using namespace std;
char* my_del_dot(string s)
{
size_t len = s.size();
char *des = new char[len+1];
int j = 0;
for (size_t i = 0; i != len; ++i)
{
if (isalpha(s[i]))
{
des[j++] = s[i];
}
}
des[j] = '\0';
return des;
}
int main()
{
string s;
cin >> s;
cout << my_del_dot(s) << endl;
return 0;
}
C++primer习题3.10 删除string字符串的标点
最新推荐文章于 2024-08-31 14:31:55 发布