Hello, I am totally new to arrays. I'm posting this in the C++ forum because my game is a mediocre console window and I guess that the solution to my array problem is simple. So, I wrote a simple "Guess the number" game and recently implemented a mediocre highscore system.
Here's how it works:
When the player gets a highscore, the program creates a text file that contains a string composed of the player's score and of the player's name (Format example : 06John). Before starting a new game, the program reads the previously created file with the use of arrays, and shows the player's name and score.
Here's a snippet of my code showing the reading part:
Here's the text file:Code:char highscore; ifstream read ("Highscore.txt"); read >> highscore; cout << "Highscore: " << highscore << " in "; cout << highscore << highscore << " turns." << endl;
As you can see, the problem is that currently the player's name is one letter. Is there a way to read (with arrays) until the end of the player's name, starting from slot 2?Code:Highscore: J in 06 turns.
I'm sure the solution is obvious.