void highscore1()
{
ifstream readfile;
int score;
readfile.open("highscore1.txt");
while(readfile >> score)
{
score += 1;
ofstream writescore;
writescore.open("highscore1.txt");
writescore << score;
writescore.close();
}
readfile.close();
cout << endl;
game();
}
how to i read from the text file, highscore1.txt and do a +1 to the integer inside the textfile and finally write the score into highscore1.txt?
Problem: my highscore1.txt show as -858993454. If i change it to zero or any other number, it will sucessfully +1 to it. so how do i if(score == ""), write 0 to it? i tried but show char * cannot change to int or something similar problem like this.
thanks!