Compare the values within an array and extract the corresponding index


I have two arrays. Array 1 is Y[0],Y[1],Y[2] and Y[3]. Array 2 is X[0],X[1],X[2] and X[3]

How to find the highest value of variables within array 1? If Y[2] is the highest value, how to write a code to show that the best value of array 2 is X[2]?

Thank you.

Is this a homework assignment for a class?

Post the code you have tried and explain what happens.

You can iterate through an array and save the index value and value of the highest data found using a for loop

Where are you stuck and where does the second array come into it ?

Sounds like an X-Y problem.

Is my school project. I don't have code since I totally don't have idea on it.

the second array, X is my input and first array, Y is my output

can you show me a simple example code? Thank you.

Sorry, but I still don't understand what you want

Please describe your project and how the code you are looking for will be used

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.