Well there are several problems I see here, but I think the main one you are having is the line:
while(cin>>fname[50]>>lname[50])if you dimensioned these two arrays with:
string fname[50];
string lname[50];
then the only valid elements are 0 - 49. So for example you could use the line:
while (cin>>fname[49]>>lname[49])if you wanted to.
I think what you MEANT was something like:
CODE
while (n++ < 50)
{
cin >> fname[n] >> lname[n];
...
}
Strings are not usually stored in arrays like that. You are entering into the wonderful world of STL and I bet you would find containers such as a vector much more convenient for your purposes.
if for no other reason than the string class overloads the [ ] operator which can be confusing: people (me) keep expecting stringvar[5] to point to the 6th char of the string stringvar, and so it can be confusing when stringvar[5] is the 6'th string in the array stringvar, and stringvar[5][5] is the 6'th char of the 6'th string of the array stringvar.