Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

vector of int to string c++

#include <vector> // vector 
#include <sstream> // string stream 
#include <iterator> // ostream_iterator 
#include <iostream> // cout 
using namespace std;

int main()
{
    vector<int> nums = {10, 7, 76, 415};
    stringstream result;
    copy(nums.begin(), nums.end(), std::ostream_iterator<int>(result, ""));
    string n = result.str();
    cout << n;
}

 
PREVIOUS NEXT
Tagged: #vector #int #string
ADD COMMENT
Topic
Name
1+7 =