Currently making a programme which allows the user to create vectors of size n, input the values and perform operations on them, such as addition, scalar multiplication.
I have no problems creating the vector and inputting the values, but am struggling to create a suitable operator overloading function for <<.
My class is named T.
My class has an set and get function. The set function inputs each element of the vector and uses the push.back to assign the values. The get function retrieves the vector from private.
Currently I have:
ostream& operator<<(ostream&, vector<T>&);
1 2 3 4 5 6 7 8 9
ostream& operator << (ostream& os, vector<T>& P)
for (int i=0; i = P.size() ; i++)
os << P.getT()[i] << "," ;