Put some more thought into it and ask a more specific question.
How do you envision the program (or function) working?
What data will be provided to the program?
What data do you expect the program to output?
Does the user interact with the program?
If so, how?
What do you want the program to do?
If you can't explain what you're trying to do, we can't help, and even if you can, we want you to at least put some effort into it. We generally do not provide canned solutions here, we help you to help yourself.
for starters you can create a 'login' class, which has member variables username and passwords. When the user logs in you create an object of this class with the provided username. you can store the existing data in some flat file and load it at the time of login and compare the password for this user against the passwd as saved in the file (encrypted or not is your call), this way you can authenticate. have public member functions to access username when required, like when you printing the score etc.