Output a string with copy function
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
using namespace std;
int main( )
{
string s( "this is a test." );
cout << s << endl;
copy( s.begin(), s.end(), ostream_iterator<char>( cout, " " ) );
}
Related examples in the same category