我在编辑器中编写了以下代码,但无法编译,它会发出警报:
cannot convert 'std::basic_string<char, std::char_traits<char>,
std::allocator<char> to 'const char*' in assignment|
||=== Build finished: 1 errors, 0 warnings ===|
代码:
#include <iostream>
//#inclide <algorithm>
#include <numeric>
#include <vector>
using namespace std;
int main()
{
std::vector<std::string> v;
v.push_back(string("a"));
v.push_back(string("b"));
v.push_back(string("c"));
string num = accumulate(v.begin(),v.end(),"");
std::cout << num;
return 0;
}
我不知道为什么它无法编译,请有人帮助我。谢谢:)