I too am writing a text game but not really for the actual game so much as for the practice. Anyway, I'm trying to get a high score list up an going but I'm stuck... I can find where the new score needs to go, I just need to put it there. Here's my code:
(this is not compilable code)Code:int i=1; int b=3; int money=550; int lowest; char TempInLine[256]; char Remaining[20][256]; while(money>=lowest){ //money is the user's score (lemonade stand is the game) File.seekg(ios::beg); while(i<oflines-b){ //oflines is the number of lines in the text file (shown below) File.getline(TempInLine,256); i++; } File>>lowest; b+=2; i=1; } File.getline(TempInLine,256); for (int index=1;index<oflines-(b-1);index++){ File.getline(Remaining[index],256); } for (int index2=1; index2<20;index2++){ cout<<TempIn[index]; //nothing happens; }
Contents of data.txt:
800
Arnold
700
Bob
600
Carl
500
David
400
Earl
300
Frank
I bet it's just something stupid in my code but I have been going through it and just can't find what's wrong. Thanks so much for all the help!



LinkBack URL
About LinkBacks


