hello! any ideas how i create users by username and password in c++?

Recommended Answers

All 4 Replies

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.

umm, alright.

The main function is a game where you guess the number and then returns the number of guesses wich will turn into some sort of score.

But before you're allowed to play the game you have to "register" with a username and password. After you're done with that the game can put your name in some sort of highscore list.

The actual game is already done but i have some trouble getting started with the registering part.

Ok so we want a user registration system where we can authenticate existing users and register new users.

So when you first start the game, do you want it to prompt for login/register or do you want to just prompt for username and password and if the username is unrecognized offer to create a new account?

Is your game a console application, does it use windows, or does it play from a server?

Where do you plan to store the usernames / passwords?

How much security do you need? (Do you care if someone 'hacks' someone else's account?)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.