写一个函数删除字符串里的所有的小写字母,主函数调用
代码如下:
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
string t = "SDIOAsjaio,asioJASOI1";
string &s = t;
deletestr(s);
cout << t << endl;
return 0;
}
int deletestr(string &s)
{
string v("");
for(auto c : s) {
if(!islower(c)) //c是小写字母是返回真
v = v + c;
}
s = v;
return 0;
}