[ create a new paste ] login | about

Link: http://codepad.org/B019pfx8    [ raw code | output | fork ]

C++, pasted on Sep 14:
#include <vector>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	vector<bool> vec;
	vec.push_back(true);
	vec.push_back(false);
	vec.push_back(true);
	vec.push_back(true);

	vec.data();
	for(size_t i = 0; i < vec.size(); i++)
	{
		if(vec[i])
			cout<<"true"<<endl;
		else
			cout<<"false"<<endl;
	}

	ofstream ofs;
	copy(vec.begin(), vec.end(), ostream_iterator<bool>(ofs, " "));
	ofs.close();
	
	return 0;
}


Output:
1
2
3
4
true
false
true
true


Create a new paste based on this one


Comments: