Array function nested loops
I have created an nested array for loop that can compare elements within each other. But I want to create a function that represents the inner loop of my nested function. Unfortuantely, I have been very successful. Here is my program so far: #include <iostream> Using namespace std; bool matchingelements(const int hand[]); int helpcomparingArray(const int hand[]); int main (); Int array[7] = {2,5,3,2,9,7,8}; if (matchingelement(array)) { cout << "there are 2 matching numbers in this array" << endl; } } bool matchingelements(const int hand[]){ int Count =0; for (int a=0; a<7;++a){ for (int b=0; b<7;++b){ if (a==b) continue; if (array[a] == array[b]) Count ++; } } if (Count ==2){ return true; } else { return false; } } } int helpcomparingArray(const int hand[]); I want to create a function to simplify nesting loop (speifically) the inner loop. But i dont know how.