I'm having trouble, I want the inner loop to display the lowest and highest score. If I assign initial values for the high and low score, it won't always work (because if no/ all scores are above/ below my initial values...)
But without assigning initial values for highscore and lowscore, One of them will always be undefined during the first runthrough.
You should set them to certain values during the runthrough. So, highest should be "-1" (ie, below the lowest accepted value) and "lowest" should be ABOVE the highest accepted value, ie maybe 101. This will make the first entered number the lowest
Also, for your lowest thing, inside the loop you have reversed the if (score <= lowest) part.
It should be
1 2 3
lowscore = score;
// Instead of
score = lowscore;
You also need to get rid of the else in front of the elseif statement for the lowscore test.
You don't need a "highscore" AND a "highest" variable: one will suffice.
I've gone through and made the suggested changes: find them below
gotcha, thanks. i had to think about that logic for awhile but it does make sense. i noticed you used two if statements in a row, i think that was also confusing me as i was trying to use if/else
The new code I've posted should have fixed that problem. The original issue was that you were never assigning a value to lowscore, as can be seen on line 52 of your posted code: you were trying to assign lowscore to score, rather than the other way around.
If you were using if/else, it may not have captured the possibility of that number being the lowest AND the highest number.
Consider the following score inputs: (with 5 scores being entered)
12
24
30
45
89
In the original code, it would have assigned 12 to be the highest number, then skipped the possibility of it being the lowest number as well. When 24 was entered, it would set that to be the highest number as well. Continuing this trend, the program would never recognise that there was a lowest number.