0

Why does this simple code not work?

I just want to print the vector. Does cout not support double? If it doesn't, this is not the error. I have the same problem with strings. Thanks! #include <iostream> #include <vector> #include <math.h> using namespace std; int main() { std::vector <double> grad; grad.push_back=1; grad.push_back =2; cout<<grad.at(0)<<endl; cout<<grad.at(1); return 0; }

4th Oct 2019, 1:21 PM
David
1 Answer
+ 2
grad.push_back(1);
4th Oct 2019, 1:43 PM
HonFu
HonFu - avatar