+ 1
Why in rand(rand()) mistake?
#include <iostream> #include <cstdlib> using namespace std; int main() { for (int x = 1; x <= 10; x++) { cout << rand(rand()) << endl; } }
1 ответ
+ 5
Дмитрий Макаров
Rand() function takes no arguments and returns an integer that is a random number between 0 and RAND_MAX. so, Rand() inside function is int which means outer Rand() considers int as argument resulting compiler error...