【发布时间】:2019-02-13 17:03:12
【问题描述】:
我正在尝试在数组中创建随机数,然后在该数组中找到最小的数。如何修改我的代码以使其正常工作?
using namespace std;
int one, two, three, four;
int main(){
srand (time(NULL));
one = rand() % 6 + 1;
two = rand() % 6 + 1;
three = rand() % 6 + 1;
four = rand() % 6 + 1;
int myelement [4] = {four, three, two, one};
cout << myelement, myelement[+4] << endl;
cout << min_element(myelement, myelement[+4]);
return 0;
}
【问题讨论】: