I'm new at this so heres my problem. im creating an online library and im stuck on one part of my code..
When I build solution, it gives me this error "error C2664: 'std::vector<_Ty>::push_back' : cannot convert parameter 1 from 'int' to 'const Item &'"
and
"error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'void' (or there is no acceptable conversion)'"
I tried everything to fix it but it just wouldnt work at all.. can anyone help me please?
heres the code
int buyNo;
vector<Item> items;
bool finished = false;
cout << "Enter the itemID (Example: 4) Type 0 when you are finished" << endl;
while (finished == false)
{
cin >> buyNo;
error 1 is this line items.push_back(buyNo);
if (buyNo == 0) {
finished = true;
}
}
cout << "You have chosen:" << endl;
for (int i=0;i<(int)items.size();i++)
{
Error 2 is this line cout << items.pop_back() << endl;
}
Thank you so much for looking!!!! much appreciated
For the first error, there is no implicit type conversion available to do the conversion. Implicit type conversions can be created via a single-argument constructor or a conversion operator.
For the second, consider using the vector::back() method for the output before calling pop_back().