C++ Code Example: prints out indices of all pairs of numbers

In this code example all pairs of numbers in a list are recognized and output with indication of the position.

#include <iostream>
using namespace std;

void getPairs(int myList[], int length) {
    for (int i = 0; i < length; i++) {
        for (int j = i + 1; j < length; j++) {
            if (myList[i] == myList[j]) {
                cout << "Number " << myList[i] << " is included two times, at indices " << i << " and " << j << endl;
            }
        }
    }
}

int main() {
    int myList[] = { 3, 5, 4, 6, 7, 2, 5, 7, 8, 3, 8 };
    int length = end(myList) - begin(myList);

    getPairs(myList, length);

    return 0;
}
Output
Number 3 is included two times, at indices 0 and 9
Number 5 is included two times, at indices 1 and 6
Number 7 is included two times, at indices 4 and 7
Number 8 is included two times, at indices 8 and 10