Question: c++ - i have multiple float variables that represent the probability of a specific outcome occuring. These are all initialized as 0.33 initialy, but i
c++ - i have multiple float variables that represent the probability of a specific outcome occuring. These are all initialized as 0.33 initialy, but i have a function that passes 3 of the 9 variables at a time by reference and within the function the values of those 3 variables get adjusted. (even though its 3 at a time usually all 9 will eventual pass through the function). The function is called through a for loop, therefore each iteration adjusts 3 of the 9 variable values. The issue is that i need to have access to the largest value of those 9 floats after each iteration but i cannot find a way to do so. I tried using an array, but if the array is declared outside of main() it remains fixed at 0.33 for all variables, if i declare the array right after the for loop it only get the last adjusted values, and within the loop array values only change once. The primary purpose is to know which of the 9 floats has the highest value after each iteration, therefore if there is a more efficent way to find that instead of getting the largest value of the 9 and then using if statement to identify which one of the 9 is = to that largest value would be greatly apprienciated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
