'Translate 2D Sequence in Array; C++

I want to implement a function that is able to translate(rotate) the sequence of a 2d array to the desired destination index. A, B, and C represents the length of the sequence. Source is the beginning of the sequence to be rotated. Source in the example below would be A. Dst is the index of the beginning of the target moving. Input/Output example: Before:

double A[][2] = { {0,0}, {1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}, {7,7} };
                          ^dst                         A      B      C 

Calling function translate(A, 8, 5, 3, 1);

{ {0,0}, {5,5}, {6,6}, {7,7}, {1,1}, {2,2}, {3,3}, {4,4} };
           A      B      C

When I run my code, the final index doesn't make it to the output array. What am I missing on the conditions?

/*
A-list of locations; 2d array
n- number of cities
src-index of the beginning of the sequence to be moved
len- length of sequence to translate
dst-index of the beginning of the target of moving
*/
void translate ( double A[][2], int n, int src, int len, int dst ) {
    vector<vector<int>> variable;
    variable.resize(n);
    //to move sequence
    for(int i = 0; i <= n - 1; i++) {
        int source_index = (src + i)%(n - 1);
        //cout << source_index << endl;
        int destination_index = (dst - 1 + i)%(n - 1) + 1;
        vector<int> variable2;
        variable2.push_back(A[source_index][0]);
        variable2.push_back(A[source_index][1]);
        variable.at(destination_index) = variable2;
    }
    
    //get vector into array
    for(int i = 1; i < n; i++){
        A[i][0] = variable[i][0];
        A[i][1] = variable[i][1];
    }
}

My output:

(0, 0),(5, 5),(6, 6),(0, 0),(1, 1),(2, 2),(3, 3),(4, 4)


Solution 1:[1]

After working through it, I think I finally got it.

    void translate ( double A[][2], int n, int src, int len, int dst ) {
    vector<vector<int>> variable;
    variable.resize(n);
    //to move sequence
    for(int i = 0; i <= n - 1; i++) {
        int source_index = (src - 1 + i)%(n - 1) + 1;
        //cout << source_index << endl;
        int destination_index = (dst - 1 + i)%(n - 1) + 1;
        vector<int> variable2;
        variable2.push_back(A[source_index][0]);
        variable2.push_back(A[source_index][1]);
        variable.at(destination_index) = variable2;
    }
    
    //get vector into array
    for(int i = 1; i < n; i++){
        A[i][0] = variable[i][0];
        A[i][1] = variable[i][1];
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Edward Mendez