+ 1
How to use random function in c++
2 ответов
0
If you write
int main() {
cout << rand();
}
then it will put out a random number.
0
After include time.h library...
int main(){
srand( time( NULL ) ); // True random numbers
cout << "Example: \n"
<< rand() // Random << endl
<< rand() % 50 + 3; // Random ( 3 - 50 )
}