标签:彩票
[root@svr7 bin]# cat lottery.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int lottery[7]={},num = 0;
srand(time(0));
for (num=0;num<=6;num++){
lottery[num] =rand() % 36 + 1;
}
for (num=0;num<=6;num++){
printf("%d ",lottery[num]);
}
printf("\n");
return 0;
}
[root@svr7 bin]# gcc lottery.c
[root@svr7 bin]# ./a.out
27 33 32 23 23 23 13
本文出自 “Linux运维之道” 博客,谢绝转载!
标签:彩票
原文地址:http://sigelinux.blog.51cto.com/8875874/1764805