vector to string c++
std::vector<char> input({ 'a', 'b', 'c' });
std::string s(input.begin(), input.end());
3.6
10
#include <iostream>
#include <string>
#include <vector>
int main()
{
std::string s = "Hello World!";
std::vector<char> v(s.begin(), s.end());
for (const char &c: v)
std::cout << c;
return 0;
}
Thank you!
10
0
Are there any code examples left?
New code examples in category C++