C 产生随机码 (输入数字来产生)

#include <stdio.h>
#include <stdlib.h>

 

 

 

main()

{

unsigned int seed; /*申明初始化器的种子,注意是unsigned int 型的*/
int k;
printf("Enter a positive integer seed value: \n");
scanf("%u",&seed);
srand(seed);
printf("Random Numbers are:\n");
for(k = 1; k <= 10; k++)
{
printf("%i",rand());
printf("\n");
}
return 0;

 

}

posted @ 2016-03-11 16:18  ocean2015  阅读(241)  评论(0编辑  收藏  举报