// Arup Guha
// 7/19/02
// This is a skeleton file to help you write and test sorting algorithms.
// Functions to fill a an array randomly and print the contents of an
// array are included.

#include <time.h>
#include <stdlib.h>
#include <iostream.h>

void printarray(int numbers[], int length);
void fillarray(int numbers[], int length, int range);

void main() {

  int values[20];
  fillarray(values,20,100);
  printarray(values,20);

}

// Prints all the values in the array numbers from index 0 to length-1
// on a line, separated by spaces.
void printarray(int numbers[], int length) {

  for (int i=0; i<length; i++)
    cout << numbers[i] << " ";
  cout << endl;
}

// Fills the array numbers from index 0 to length-1 with random integers
// ranging from 1 to range.
void fillarray(int numbers[], int length, int range) {

  srand(time(0));
  for (int i=0; i<length; i++)
    numbers[i] = rand()%range + 1;
}
