最佳答案
您的code
变量是std::string
。 std::string
类没有使用另一个push_back()
作为输入的std::string
方法。您应该尝试使用+=
运算符,该运算符可以接受字符或字符串:
string encode (string message, string key) {
string code = "whatever";
string forst;
int num;
string::size_type begin = 0;
message = lower_and_strip(message);
for (char val : message) {
num = return_encoded_char(key, begin, val);
forst = to_string(num);
code += forst; //*******************************
}
return code;
}
https://stackoverflow.com/questions/42446667/
相关文章:
c# - 从字符串中过滤掉非十六进制字符的更好方法是什么?
c++ - 将 OpenCV Mat 转换为数组(可能是 NSArray)
java - 计算字符串中的空格数
c++ - static_assert 内部/外部类定义
c++ - integer_sequence 和默认参数值
c++ - 在 C++11 中,string::c_str() 指向的数组中的字符可以改变吗?
java - 从字符串中删除所有空格和标点符号(任何不是字母的)?
c++ - C++0x 中 allocator_traits<T> 的目的是什么?
c++ - 了解勘误表中有关 EMC++ 第 41 项的评论
c++ - 指针地址给出 1 而不是十六进制地址