Sign in to follow this  

Creating a High Score List - Need Help

This topic is 4246 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello to whoever reads this, :) Im creating a Random Number game. Its comming along nicely...and more importantly, it works. :) Right now, im trying to think of new things to add to it. One thing that popped into my head was a High Score type list. This list would store the players name and their best score...which in this case, would be the lowest number of tries it took him/her to guess the random number. The thing is, I want the names and scores to stay. I don't want the list to disappear when the user closes the game. So what im asking is, what would I have to create to make this work? This is a console app, so I don't know if its possible to make something like this for a console app. If anyone could give me any suggestions on what I could try to create or somewhere I could look to answer my question, I would greatly appriciate it. Thanks. Edit: forgot to mention that im a beginner with limited...ok no experience. Been learning C++ for about a month or two. This game is being created using C++ [Edited by - Koolchamp on April 30, 2006 10:20:54 PM]

Share this post


Link to post
Share on other sites
Sounds like you just want some simple file streaming. The classes you want are ofstream (for writing out the high score list), and ifstream (for reading it back in); just include <fstream> to use them.

Reading up on the classes a little should make it fairly clear what functions you'll need to use, I think, but post back here if you have any problems.

Share this post


Link to post
Share on other sites
And try to write the highscore file in binary at least so that it is not as easy to change. Haha, else people will just open it in notepad and change it. Or else encrypt it so that people can't change as they like. File handling is very possible in console application. Just that u have to be aware of pathnames of the files, don't get it wrong.

Share this post


Link to post
Share on other sites
jyk
Jackrhino

Thanks for the responses. I've found a couple of sites that talk about file streaming & ill look in the C++ books I have...should be interesting to read sense I have no idea what it is, but hopefully after I read about it, ill have a pretty good understanding of it. Once again, thanks for the suggestions. If I have any question...high possiblity...ill just ask.

Share this post


Link to post
Share on other sites

This topic is 4246 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this