0

I'm not understanding my assignment and what I've read has really confused me. This is what I need to do: write a function to initialize an integer Partially Loaded Array with distinct random values. The array has room for 50 elements. The actual number of elements to store will be determined by the following equation:

intNumberOfElementsToStore = 10 + 25 * ((double) rand() / (double) RAND_MAX) ;

This is what I wrote:

```
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std ;
const int ARRAY_SIZE = 50 ;
int numberOfElementsToStore[ARRAY_SIZE] ;
double populateArray(int numberOfElementsToStore[]) ;
double printArray(int numberOfElementsToStore[]) ;
int main()
{
double srand((int) time (NULL ) ) ;
populateArray(numberOfElementsToStore) ;
printArray(numberOfElementsToStore) ;
return 0;
}
double populateArray(int numberOfElementsToStore[] )
{
int i = 0 ;
for (int i = 0; i < ARRAY_SIZE; i++)
{
numberOfElementsToStore[i] = 10 + 25 * ((double) rand( ) / (double) RAND_MAX ) ;
}
return i ;
}
double printArray(int numberOfElementsToStore[])
{
int i = 0 ;
for (int i = 0; i < ARRAY_SIZE; i++)
{
if ((i+1) % 10 == 0)
cout << fixed << setw(6) << numberOfElementsToStore[i] << " " << endl ;
else
cout << fixed << setw(6) << numberOfElementsToStore[i] << " " ;
}
return i ;
}
```

This does give me numbers, but not distinct. Thanks!