I'm having trouble on how to call my function and I've searched thoroughly for over an hour now and just can't seem to find the answer.
Example code:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
struct student
{
string first
string last
}
void lookup_student(vector <student> *classes);
int main()
{
vector <student> classes;
//put stuff here that fills up vector and such
lookup_student(&classes);
return 0;
}
void lookup_student(vector <student> *classes)
{
cout << classes[0].first;
}
I just made this up on the spot since my current program has around 300 lines at the moment and this example explains exactly what I need. I'm sure either I'm declaring the struct vector wrong in the function or else I'm doing it wrong in main. Any help would be greatly appreciated.
The error message it gives me is that std::vector <student> has no member named first
.