// 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 <cstdlib>
#include <ctime>

using namespace std;

bool already(int v, int *a, int n)
{
   for(int i=0;i<n;i++)
   {
      if(v==a[i]) return true;
   }
   return false;
}

int main()
{
   srand(time(NULL));
   int a[10];
   for(int i=0;i<10;i++)
   {
      do
      {
         a[i] = rand() % 10 + 1;
      }
      while(already(a[i],a,i));
   }
   for(int i=0;i<10;i++)
   {
      cout << a[i] << endl;
   }
   return 0;
}
