I am having trouble doing the following:
1. Outputting information that has just been entered using cin.
2. Ouputting the position of the vector element.
3. Deleting a given record using cin.
A sample code on these things would be great as I would rather a reference to build on instead of copy paste code.
That's because sVec is a vector of objects. You need to specify which data member must be displayed with the '.' operator like you did with the elements of Vec.
I gullibly thought sVec was a vector of objects without noticing "Record Number" and your (2.). So skip this post. See JLBorge's post below me.
for( unsignedint i = 0 ; i < Vec.size(); ++i )
{
cout << "Info: "
<<"\n\n Name: " << Vec[i].name
<< "\nID: " << Vec[i].ID
<< "\nEmail: " << Vec[i].Email
<< "Record Number: " << i+1 // sVec[i]
// note: i+1 if the first record is record #1
// just i if the first record is record #0
<< "\n--------------------------------------\n";
}
What I see is that the first three items use "Vec", you should use a lowercase letter here, and "Record Number" used "sVec". There is a good possibility that "sVec" is not the same size as "Vec" (shorter), so you may be trying to access "sVec" past its end.
What I do not see is how the vectors are defined and how they get their information and what is in each vector. Here more code would be of greater help than less code as the problem may start somewhere before you get to this loop.
"Vec[i].name" appears that it could be a vector of structs which makes me wonder why "Record Number" is not part of that struct and why you put it in a different vector.
Unfortunately with out the rest of the code I have no way of testing just the for loop. Or knowing what is in the vectors.
The vector intitally has 3 empty elements so the information will be pushedback starting from 4.
Why? If "Vec" starts with three empty elements does "sVec" start with three empty elements?
im getting a no match for operator << on the record number line