#include <iostream>
using namespace std;
#include <stdlib.h>
#include <time.h>
int main()
{
int i;
srand((unsigned)time(NULL));
for (i=0; i<10; i++)
{
cout<<rand()<<"/t";
}
cout<<endl;
return 0;
}
...全文
120013打赏收藏
高手们帮忙把这段C++改写成VBS,谢谢了
请问各位大牛,如何将这段C++改写成VBS呢?我需要用VBS执行srand()函数和rand(),并将结果以msgbox输出结果,高手们帮帮忙,谢谢了~~ #include using namespace std; #include #include int main() { int i; srand((unsigned)time(NULL)); for (i=0; i<10; i++) { cout<<rand()<<"/t"; }
感谢高手的耐心解答,如果要产生0到99999的随机数,代码是不是这样写:
Dim i
Call Randomize
For i = 1 To 10
MsgBox "第" & i & "个随机数:" & int(90000 * rnd()), 64,"随机数"
Next
还有就是Randomize函数的问题我表述得可能不是很清楚,其实我想问的是,如果当前系统时间是15:00,但是我却想用16:00作为随机数种子,那代码应该怎么写呢?先谢过~~