printing vectors ERROR

hi;

i wrote a code taking inputs from a file and then send these inputs to a float variable.
1
2
3
4
5
6
for(vector<float>::size_type j=0;j<3;j++)
		{
			myfile >> y;
			temp(j) << y;
			cout << temp(j);
		}


but this gives the error: term does not evaluate to a function taking 1 arguments
Last edited on
What exactly are you trying to do in line 4 and 5?
trying to send some float variables into a vector and then print the vector.
Is temp an array or vector? If so, try square brackets

1
2
3
4
5
6
for(vector<float>::size_type j=0;j<3;j++)
{
	myfile >> y; // myfile is an ifstream and y a float?
	temp[j] = y; // set vector element (temp is a vector of floats?)
	cout << temp[j];
}


If not, what is it?
Last edited on
thnak you this worked with () instead [].
Topic archived. No new replies allowed.