Last active
June 8, 2017 20:50
-
-
Save alivcor/e53712ef111fccfa835763cbbaf738b8 to your computer and use it in GitHub Desktop.
C++ Function to print contents of an unnested Int Vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "vector" | |
#include "string" | |
using namespace std; | |
void printIntVector(vector<int>& nums){ | |
string s; | |
for(auto it = nums.begin();it!=nums.end(); ++it){ | |
s.append(to_string(*it)); | |
s.append(", "); | |
} | |
std::cout << s.substr(0,s.length()-2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment