gpt4 book ai didi

c++ - 从字符串中删除所有空格

转载 作者:太空宇宙 更新时间:2023-11-04 15:04:54 26 4
gpt4 key购买 nike

<分区>

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string str;
cin>>str;
str.erase(remove_if(str.begin(), str.end(), isspace),str.end());
cout<<str;
return 0;
}

错误消息:

/home/satish/Desktop/CPP/Remove_Spaces/main.cpp|9|error: no matching function for call to ‘remove_if(std::basic_string::iterator, std::basic_string::iterator, )’|

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com