+ 2
Can anyone explain me the following code?
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main () { srand(time(0)); for (int x = 1; x <= 10; x++) { cout << 1 + (rand() % 6) << endl; } }
1 ответ
+ 10
The code outputs 10 random numbers ranging from 1 to 6.