c语言rand,srand用法
发布日期:2021-06-29 11:14:10 浏览次数:3 分类:技术文章

本文共 321 字,大约阅读时间需要 1 分钟。

#include 
#include
#include
#include
#include
#include
#include
#include
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;}

转载地址:https://blog.csdn.net/ZWHSOUL/article/details/80146566 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:使用calloc()、malloc()和free()分配和管理内存
下一篇:php的foreach循环

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2024年04月04日 08时18分04秒