Code:
exercise2.cpp:17:19: error: C++ requires a type specifier for all declarations
void read_ages(&name, n) // member function
^
exercise2.cpp:17:25: error: unknown type name 'n'
void read_ages(&name, n) // member function
The error tells you in no unspecific terms what's wrong. It just doesn't make sense that you're struggling with this while writing methods - this is a running before walking scenario. That's why I asked if you're coming from another language and jumped into this head first.
What you may have wanted is something like:
Code:
void read_ages(const std::string& name)
{
names_vec.push_back(name);
double age;
cout << "Please enter an age for " << name << endl;
cin >> age;
ages_vec.push_back(age);
}
But that wouldn't actually help you because there are several other problems waiting and they're due to not being familiar with certain concepts yet. Nobody can fill that gap except you.