Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wrote a code to login box,now i need to add uniqueness to usernames..i tooked an array and stored all existing users data from file...i need to compare that,how i can compare a single variable with an array
Posted

Instead of array, you can use a container which support uniqueness, for example
http://www.cplusplus.com/reference/unordered_map/unordered_map[^].
In you case, the user name should be used as a key, and all user information as a value (mapped) type T.

For big volume of user information, you could use a relational database, and you would have to have a users table where a user name is used as a primary key.

—SA
 
Share this answer
 
Stored in form of array by reading the pre-existing file, and compared by pointing at each index values and proceeded with further steps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900