Basically, i want to read highscores from a file and check if the user has scored enought points to be on the scoreboard. I'm trying to do it like this:
string initials[10];
int scores[10];
//load txt
ifstream highscores("highscores.txt");
if(highscores.is_open())
{
while(highscores.good())
{
for(int x=0;x<10;x++)
{
getline(highscores,initials[x],' ');
highscores >> scores[x];
}
}
}
the initials are only 3 chars long, so i could implement a 2 dim. array but i wanted to try it with strings. It shows that i mad one string of size 10. How should i write it so it will work with 10 arrays instead of 1? (I know i could make 10 arrays naming them from array1.. to 10, looping through them sound much better. The highscores file is just a set of 10 initialas AAA,BBB etc. and some scores.
Example of highscores.txt:
AAA 5000
BBB 4000
CCC 3000