# Working on High Scores...

• 02-15-2003
Gnoober
Working on High Scores...
I'm working on a function that seeks out where a high score should go in a text file. For some reason it loops until it gets to the highest number in the list. Here is the contents of "data.txt" and the problem code:

800
Greg
700
Suzy
600
George
500
Fred
400
Frank
300
Bob

Code:

```void putit(){         int i=1;         int b=1;         money=550;         while(money>=lowest){                 File.seekg(ios::beg);                 while(i<numberOfLines-b){                         File.getline(TempInLine,256);                         i++;                 }                 b+=2;                 File>>lowest;         } }```
I just know it's something stupid but I've gone thru it too many times and just cannot figure it out. The problem is that "lowest" always is equal to 800 (the highest number in the list) no matter what the value of "money" is. Thanks for any help!
• 02-15-2003
nextus
what is the value of lowest when it first starts?
• 02-15-2003
Gnoober
This function finds the lowest number and I run it before I run putit().

Code:

``` void lowestnumber(){                 int i=1;         File.seekg(ios::beg);                 while(i<oflines-1){                 File.getline(input,256);                 i++;         }         File>>lowest;                 }```
So... the value of lowest is 300 before putit() starts.
• 02-15-2003
Gnoober
I'm doing the high scores by myself. If anyone has any tips on how to do high scores more efficiently, please help me out. Maybe a different format of the text file or something...
• 02-16-2003
Gnoober
I figured it out, if anyone was working on it. The problem is that "i" is never reset back to 1 in the loop. Thanks for all the help guys!