c++ - How to find matching values in several arrays -


I have an array of integers, each of them is with unknown length, I get matching pairing in all the arrays. What is the best way to do this? For example, these arrays were given -

  const int array_01 [8] = {1, 8, 6, 7, 9, 1, 3, 7}; Const int array_02 [11] = {3, 2, 1, 8, 2, 8, 4, 5, 9, 7, 10}; Const int array_03 [10] = {4, 0, 6, 7, 7, 2, 1, 2, 2, 9};  

will be matched -

  array_01, array_02 - 1, 3, 7, 8. array_01, array_13 - 1, 6, 7. array_02, Array_03 - 1, 3.  

Try it You can add matches for 2 arrays .

  function match_array (array1, array2) {var match = array (); For (int i = 0; i & lt; array1.length; i ++) for (int j = 0; j & lt; array2.length; j ++) {if (array1 [i] == array2 [J]) {match.push (array1 [i]); }} Return Match; }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -