// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <ctime>

using namespace std;

int a[4][2] = { {0,0}, {1,0}, {2,0}, {0,1} };

int main()
{
    int b[4];
    /* print */
    for(int i=0;i<4;i++) cout << "(" << a[i][0] << "," << a[i][1] << ")";
    cout << endl;
    /* construct array with random numbers */
    srand(time(NULL));
    for(int i=0;i<4;i++) b[i] = rand();
    /* sort original array after random array */
    for(int i=0;i<3;i++)
        for(int j=(i+1);j<4;j++)
            if(b[i]>b[j])
            {
                swap(b[i],b[j]);
                swap(a[i][0],a[j][0]);
                swap(a[i][1],a[j][1]);
            }
    /* print */
    for(int i=0;i<4;i++) cout << "(" << a[i][0] << "," << a[i][1] << ")";
    cout << endl;
    return 0;
}
