Firstly, if you're going to put code in your posts, please put them in [ code ][ /code ] tags (without the spaces).
Here's a possible solution:
Code:
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include <memory.h>
#define RAND_SIZE 100
#define NUMBERS 20
int main(void)
{
int flags[RAND_SIZE];
int numbers[NUMBERS];
int i;
memset(flags, 0, sizeof(flags));
memset(numbers, 0, sizeof(numbers));
srand(time(NULL));
for(i = 0; i < NUMBERS; i++)
{
int num = rand() % RAND_SIZE;
if(flags[num])
{
i--;
continue;
}
flags[num] = 1;
numbers[i] = num;
}
cout << "The random numbers are:\n";
for(i = 0; i < NUMBERS; i++)
{
cout << numbers[i] << endl;
}
return(0);
}