Function Help

Hello everyone. I just have a quick question about my program. My program is basically a vector of a structure that holds an int, 3 strings, and a double (student information).

I have a recursive binary search function that I use to find the position of the student and such. Everything works fine except that my professor requires object oriented programming with classes for each project, and I just have everything in my cpp file. Normally that would be fine, but what I'm confused about is how I can pass the vector of the struct into the function when the struct is in the cpp file. For example here's the function prototype and the struct it used:

1
2
3
4
5
6
7
8
9
10
int binarySearch(vector<searchVal> &vectorOne, int x, int first, int last)

struct searchVal
{
  int id;
  float gpa;
  string first_name,
  	  	 last_name,
  	  	 address;
};


It would be easy if its just a vector holding an int but since its holding a certain struct from the cpp file how would I be able to put it into the header file? Thanks for your help!
Last edited on
D:
How about moving line 1 after the line 10?
Oh it is. I was just putting them both up to show what I mean by the vector of a struct.
Topic archived. No new replies allowed.