Hi. I have a struct where there's a firstname, a surname, and a custom number - from a file. Now, I need to create a function, where the user enters the firstname, then the surname, and the function couts the name, if it's in the struct, and the number.
I tired something like this:
1 2 3 4 5 6 7 8 9 10 11 12
char tempFirst[20];
char tempSur[20];
cout << "Please type in the firstname of the client!" << endl;
cin >> tempFirst;
cout << "Now the surname!" << endl;
cin >> tempSur;
for(int i = 0; i<sum; i++){
if(results[i].firstName == tempFirst && results[i].surName == tempSur){
cout << "I found him/her. The number is: " << results[i].identNumb << endl;
}
}
It's not working, guess because some names are longer than the others, and there's obviously less than 20 character lenght names. Anyway, I tired it with strings, but I got the same result.