This is not a compiler issue this is a programmer issue (hint : it's rarely if ever the compilers fault)
I'm being nitpicky here but you do not need to do
string wrd="";
the <string> library automatically initializes a string to "" in the default constructor. (see :
http://www.cplusplus.com/reference/string/string/string/ )
[edit: in case that went over your head, just use the code
string wrd;
there is no need to re-initialize[read: re-set] the value to "" [or empty])
Before I go any further though, clodi I want you to indent your code so it's easier to read(for your sake and ours)
Doing things like :
{if (wrd==nmbs[i]) {cout<<i; break;}
obscures in which block a certain line of code lies, there is no point in saving space if you can't get your program to run.
Go through your program but use a pen and paper, follow the logic and you will see where your error is.
One last thing :
if (a!=nmbs.size()-1);
if a is not equal to the vector size then what? If you run through it with a pen and paper it will help clarify where you messed up. If you are still struggling after you've attempted it feel free to reply and i'll give you the solution.