Ok, I should probably just wait and look at it again tomorrow before posting this because I know I should be able to figure it out. But.......
I get the error " 'fail' undeclared " It is declared in the extract_fails function and I realize it is out of scope in main() but I can't figure out to get it to work. Shouldn't I be able to reference it somehow. I have posted only the extract_fails() and the relevent portion of main(). If more is needed, I'll post the rest.
Thanks. I hope my question is clear...I'm getting cross-eyed.
Code:
// include files........
vector<Student_info> extract_fails(vector<Student_info>& students)
{
vector<Student_info> pass, fail;
vector<Student_info> students;
for (vector<Student_info>::size_type i = 0;
i != students.size(); ++i)
if (fgrade(students[i]))
fail.push_back(students[i]);
else
pass.push_back(students[i]);
students = pass;
return fail;
}
int main()
{
// more code here (students and grades being entered)
extract_fails(students);
vector<Student_info> fail; //edit: oops. not in the code
for (int i = 0; i != fail.size(); ++i) //list failing students
cout << endl << fail[i].name;
system("PAUSE");
return 0;
}