【发布时间】:2022-08-14 23:23:19
【问题描述】:
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
int main(){
std::string text;
std::getline(std::cin, text);
std::set<std::string> filter;
for(int i = 0; i< text.length(); i++){
filter.insert(text[i]);
}
}
我的代码出现错误,它说:
没有已知的参数 1 从 \'__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type\' {aka \'char\'} 到 \'std::initializer_list<std::__cxx11: :basic_string<字符>>\'
我需要将每个转换为
char,然后插入到集合中吗?
-
你能用简单的英语用几个例子来描述你的程序应该做什么吗?如果你被要求设计一款新车型,仅仅将最终结果描述为“踩下油门踏板前进”是不够的。
-
您希望您的集合包含单词(字符串)还是字母(字符)?