You can't "send" floats to a vector (are you thinking of cin >> usage here?). But, if 'y' is some random float and 'temp' is a vector of floats, you can set the value of an element
temp.at(j) = y; // set the element at index k to y
or
temp[j] = y;
(here, the vector must have a size of at least j + 1)
or append an element to the back of the vector
temp.push_back(y); // add y to the end of the vector
(push_back increases the size by 1)
For other things you can do with vector, see (e.g. insert)
http://www.cplusplus.com/reference/stl/vector/
Andy
PS But you can read a float from cin (or from a file using ifstream, etc) into a vector element if the vector is big enough.
1 2 3 4
|
vector<float> temp(10); // vector starts off with 10 zeroed elements
cin >> temp.at(2); // ok (2 is less than 10)
cin >> temp[3]; // also ok
|
operator>>, in this case the extraction operator, is intended for use with input streams. And as guestgulkan has already said, operator>>, as the right bit shift operator (e.g.
m = m >> 3; // shift m 3 bits to the right
) only works with integers.