1) you need to get a better c++ textbook. Your's teaches you ANCIENT style. Or maybe you are coming from a C background?
2) If it hangs, check your loops. They most probably have wrong conditions when they should stop.
E.g. while((!found)&(first<=last)) looks suspicious. Maybe you mean && ?
If you just need to get the job done, use the STL instead of writing your own search. sort() and lower_bound() is probably what you want here.
If you have to do it by yourself (homework, exercise, etc..)
I recommend you search for an example of binary search in C++. I bet wikipedia has one. Getting this done correctly is hard! There can be a lot of subtle small problems everywhere.
(Or you could try to decipher your std::lower_bound, but the STL-stuff source code is usually very hard to read).
If you really want to sit this through by yourself, best is to use a debugger and step-by-step execute your loop until you find out why it does not quit correctly.
If you even don't want / can't use a graphical debugger, then it's paper-time. Grab a piece of paper and go through the code by hand and write down what state each variable has step by step. But I think that's ridiculous. ;-). As an alternative, you can write "cout << " statements all over the place to get some debug-output.