I have to set the vector in this for loop equal to an array that I pass to it in the containing function, I'm not sure how to do this, can someone elaborate on what I've done wrong.
for (int x = 0; x < numCreatures; x++)
{
cout << "The following is a list of all the creatures you take care of:"
<< profile[x].name << endl << endl << endl;
cout << "What creature do you wish to remove?" << endl
<< "CREATURE NAME: ";
cin.ignore();
getline(cin, profile[numCreatures].name);
std::vector<int>;
const(&profile[0], &profile[x]);//mess up is here im 99% sure.
auto x = std::find(const.begin(), const.end(), profile[x].name);
if (x != const.end())
{
const.erase(x);
}
else
{
std::cerr << "Could not find profile!\n";
}
cout << "You have removed " << profile[x].name << "." << endl << endl;
}
What is line 11 doing? Is it supposed to be defining a vector object? Because std::vector<int> is just a type - it's syntactically equivalent to just writing:
int;
You need to give your vector a name, just like you would any other variable.
What on earth is line 12 supposed to be doing? It makes no sense whatsoever.
Edit: You know that const is a C++ keyword, right? You can't use it for a variable name, which seems to be what you're trying to do.