This program is supposed to take the input of four scores, drop the lowest score and average the remaining three. The score range is (0.0 - 10.0). I have it so that it recognizes whether two scores are the same but then it just eliminates them both. How do I fix this issue?
Are you familiar with "vector"s? That would very easily cout out most of the if/else statements. Another advantage to vectors is that they can grow or shrink as needed. So, if you add more judges it is not a problem.
Otherwise you would need other code to determine which judge has the highest score. This could be another set of if/else if statements or reworking what you have.
Looking at what you have I am thinking that (j1 < j2 && j1 < j3 ...) would work better to find the highest score. An it might need to be (j1 > j2 && j1 > j3 ...). Without testing I believe the > an && would find the highest number better.
I noticed that J1... are defined as floats, but the last lines of the program say to use integers. This does not match. Also your numbers should be small enough to use floats, but doubles are the preferred type.
Thanks Andy. Yeah I'm sure vectors would be useful but this is only chapter 5 of the textbook so we haven't covered that yet. let me give your solution a try and I'll get back to you with the result.
UPDATE: The && solved all the issues I was having. Thanks!
Thinking about the if/else if statements the order in which you do the might make a difference, e.g.,:
j4 > j1 && j4 > j2...
j3 > 1j && j3 > j2...
j2 > j1...
j1 > j2...
I did not try this yet, but my original testing with your original code an even with y changes did not work right.