I want to cout
the contents of one of my vectors in the following simple program:
#include<iostream>
#include<ios>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
string name;
double median;
int x;
vector<double> numb, quartile1, quartile2, quartile3, quartile4;
cout << "Please start entering the numbers" << endl;
while (cin >> x)
{
numb.push_back(x);
}
int size = numb.size();
sort(numb.begin(), numb.end());
for (int i = 0; i < size; i++)
{
double y = numb[(size / 4) - i];
quartile1.push_back(y);
}
cout << quartile1; // Error here
return 0;
}
Whenever I try to compile this I get this error:
Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::vector<double,std::allocator<_Ty>>'
(or there is no acceptable conversion)
c:\users\hamza\documents\visual studio 2013\projects\project1\project1\source.cpp 30 1 Project1
2 IntelliSense: no operator "<<" matches these operands
operand types are: std::ostream << std::vector<double, std::allocator<double>>
c:\Users\Hamza\Documents\Visual Studio 2013\Projects\Project1\Project1\Source.cpp 29 7 Project1
What is the error with the <<
operator?