#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
unsigned char name;
/*volatile*/ unsigned seed = (unsigned)time(NULL);
for (int i = 0; i < 4; i++)
{
srand(seed++);
name = rand() % ('z' - 'a' + 1) + 'a';
/*范围区间(max,min),output = rand%(max-min+1)+min*/
if(0 == i)putchar(name-'a'+'A');
else(putchar(name));
}
return 0;
}
[C]连续产生随机数取英文名(不用sleep)
最新推荐文章于 2021-10-18 17:35:29 发布