subject_20291.htm
来自「一些关于vc的问答」· HTM 代码 · 共 4 行
HTM
4 行
<p>
序号:20291 发表者:longren 发表日期:2002-11-05 12:43:30
<br>主题:经常遇到的小问题
<br>内容:#include"iostream.h"<BR>#include"stdlib.h"<BR>static const int size=101;<BR>static const int seed=3000000L;<BR>static int first_time=1;<BR>static double rand_table[size];<BR>static double last_rand;<BR>void orignrandom(unsigned long iseed)<BR>{<BR> srand(iseed);<BR> int i;<BR> for(i=0;i<size;i++)<BR> rand_table[i]=rand()/(RAND_MAX+1.0);<BR> last_rand=rand()/(RAND_MAX+1.0);<BR> first_time=0;<BR>}<BR>double randrom()<BR>{<BR> int index;<BR> if(first_time)<BR> orignrandom(seed);<BR> index=int(size*last_rand);<BR> last_rand=rand_table[index];<BR> rand_table[index]=rand()/(RAND_MAX+1.0);<BR> return last_rand;<BR>}<BR>void mian()<BR>{<BR> double ran;<BR> for(int i=0;i<10;i++)<BR> {<BR> ran=randrom();<BR> cout<<ran<<endl;<BR> }<BR>}<BR>Linking...<BR>LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main<BR>Debug/5.exe : fatal error LNK1120: 1 unresolved externals<BR>Error executing link.exe.<BR>5.exe - 2 error(s), 0 warning(s)<BR>我试图改工程菜单的设置,依然没有用的,请教高手是怎么回事的。还有RAND_MAX的值是多少的。<BR><BR>2002-11-5 13:24:08
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?