【发布时间】:2021-01-06 13:23:47
【问题描述】:
我尝试阅读其他问题以找到我的问题的答案,但我厌倦了看到使用不同编码语言的答案。我想更改随机错误代码中的数字数量。我对此真的很陌生,所以请不要粗鲁的 cmets。
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main () {
int i,j[3];
srand( (unsigned)time( NULL ) );
我将 j 的数组设置为 3,这样我就可以尝试获得最多 3 个数字。
for( i = 0; i < 1; i++ ) {
j[3] = rand();
cout <<"Error code: " << j << endl;
}
return 0;
}
这里是错误出现的地方,代码的输出只发送变量地址而不是随机数。在继续我的项目之前,我真的需要帮助。请帮忙。
编辑:变量地址为“0x7ffc9b46ed5c”
【问题讨论】: