I have been working on this code now for about a month and still am getting errors at line 88 when I am doing a binary search for a data structure. The full code is here. I am wondering if I am loosing a connection to the MID when I do the search. Thanks for any input.
1) Use int main().
2) If FIRST <= LAST (like you have an array of only one element), then you could get to line 95 without actually having given MID a value. Not sure why the warning is on line 88 though.
3) I'd highly suggest using functions in this case to make the code cleaner, as it is it is really hard to read.
getting errors at line 88 when I am doing a binary search for a data structure
what kind of errors?
In C++ you can declare variables where they are need. So you can omit line 24 and write at line 78 constint MID=(FIRST+LAST)/2; // Since it doesn't change it can be const and the other variables alike
and yes, better write a function for the binary search (which is usually recursive)
OK, Thank you both I am going to go and do that. The error that i am getting is it says that MID is not being initialized but it does link back up to the top where I stated in the variables that MID is an int.