#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
using namespace std;
int main() {//rand, time随机函数的用法
while (1) {
Sleep(1000);
srand(time(0));//随机种子 time(0)返回时间值
int r = rand() % 100 + 1;//随机输出一个0到100内得数
printf("%d\n", r);
}
return 0;
}
c语言rand,srand用法
最新推荐文章于 2024-05-04 23:45:19 发布