Hey, i am trying to search an array of surnames. I am entering in a surname, and if that surname is in the array, i want to to bring out all other details for that surname that are stored in a structure. At the moment, i have this working for the reference number. The code for that is:
cout << "Please enter an associate reference number :" << endl;
cin >> SearchNum;
while((RecNum < MAX_QUOTES) && (SearchNum != Quote[RecNum].RefNumber))
{
RecNum++;
}
This then, if found, out puts all the details in the Quote structure for all the details of that record number.
However, when i try this for the surname, which is very similar, it doesn't work:
cout << "\n\nPlease enter an associate surname :" << endl;
cin.getline(SearchName,NAME_LEN);
while((RecNum < MAX_QUOTES) && (SearchName != Quote[RecNum].Surname))
{
RecNum++;
}
SearchName takes in the surname i enter along with some other stuff after it. I was wondering how to get rid of all the stuff after the surname to get this to work. I think its something to do with '/0' but that just stores up the remaining space with /0. It wont bring out the results for Snape as searchname is stored as Snape/0/0/0/0.
Any help would be great.
Ian