I think you should be comparing the string WITHIN the struct.
Username[i].usernameadmin == username
This would compare string username
with string usernameadmin
.
The ==
operator can be used to compare strings in C++, thanks to overloading.
You can still use .compare
as well.
Username[i].usernameadmin.compare(username)
10
solved How to compare a string with a struct (which include strings too)? [closed]