⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_41238.htm

📁 vc
💻 HTM
字号:
<p>
序号:41238 发表者:白云飞扬 发表日期:2003-05-25 13:34:10
<br>主题:C++里怎么产生随机数?
<br>内容:#include&lt;stdlib.h&gt;<BR>#include&lt;time.h&gt;<BR><BR>main()<BR>{<BR>&nbsp;&nbsp;int i;<BR>&nbsp;&nbsp;randomize();<BR>&nbsp;&nbsp;i=random(30);&nbsp;&nbsp; //产生从0-29的随机数<BR>}<BR>&nbsp;&nbsp;<BR>提示错误:undeclared identifier<BR>难道是头文件包含错误?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:theta 回复日期:2003-05-25 15:32:53
<br>内容:srand( (unsigned)time( NULL ) );<BR>i = rand()%30;
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -