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!