error std::ostream_iterator undeclared identifier
Can you help with this error?
line 31: error C2065: 'ostream_iterator' : undeclared identifier
line 31: error C2062: type 'int' unexpected
but std::ostream_iterator<int>(file,",")
also prints error that ostream_iterator is not member of std.
stdafx.h
1 2 3 4 5
|
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<conio.h>
|
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include "stdafx.h"
using namespace std;
int main()
{
vector<int> vektor(10,3);
cout << "Original vector:" << endl;
for(vector<int>::iterator i = vektor.begin();
i != vektor.end(); i++)
cout << *i << '\t';
cout << endl;
fill(vektor.begin(),vektor.end(),20);
cout << "vector has been filled with numbers 20:" << endl;
for(vector<int>::iterator i = vektor.begin();
i != vektor.end(); i++)
cout << *i << '\t';
cout << endl;
fill_n(vektor.begin() + 2,5,100);
for(vector<int>::iterator i = vektor.begin();
i != vektor.end(); i++)
cout << *i << '\t';
cout << endl;
ofstream file("test.txt");
fill_n(ostream_iterator<int>(file,","), 10, 0);
file << endl;
_getch();
return 0;
}
|
Last edited on
#include <iterator>
thank you
Topic archived. No new replies allowed.