vendredi 10 juillet 2020

Print integer from array A based on array B integer?

New to C++. I am looking for advise on the approach to this problem.

Given the following array:

Array A

1 21 43 54 99

Array B

1 4 5

What I want to achieve:

Array B integer is use to find the position of the value in array A. The end result, using the above two array, will be

End result

1 54 99

Where array B 1 will extract 1 from array A, array B 4 will extract out 54 from array A and so on. How should I approach this problem?

Aucun commentaire:

Enregistrer un commentaire