/*
*
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#define size 1001
int main() {
int num[size], f[size], count = 0, x, a = 0, u[size];
memset(f, 0, sizeof(f));
memset(u, 0, sizeof(u));
srand((int)time(NULL));
while(count < size) {
x = rand() % size;
if(f[x] == 0) {
num[count++] = x;
f[x] = 1;
}
}
for(x = 0; x < size; x++)
printf("%5d", num[x]);
for(x = 0; x < size; x++)
a &= x;
printf("\n\n%d\n", a);
printf("************\n");
for(x = 0; x < size; x++)
u[num[x]] = 1;
for(x = 0; x < size; x++)
if(u[x] == 0)
printf("%5d", u[x]);
printf("************\n");
}
产生随机数
最新推荐文章于 2024-02-18 22:59:30 发布