Skip to content

Instantly share code, notes, and snippets.

@krysseltillada
Created July 27, 2015 08:43
Show Gist options
  • Save krysseltillada/d3416fa73bd7695f45aa to your computer and use it in GitHub Desktop.
Save krysseltillada/d3416fa73bd7695f45aa to your computer and use it in GitHub Desktop.
exercise 9.5.1(a)
#include <iostream>
#include <vector>
#include <string>
int main ()
{
const size_t sz = 2;
char c_str[] = {'2', '3'};
std::vector <char> c;
for (unsigned i = 0; i != sz; ++i) {
c.push_back (*(c_str + i));
}
std::string str(c.begin(), c.end());
std::cout << str << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment