fork(18) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. /* rand example: guess the number */
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <time.h>
  8.  
  9. int main ()
  10. {
  11. int n;
  12.  
  13. /* initialize random seed: */
  14. srand ( time(NULL) );
  15.  
  16. cin>>n;
  17. cout<<rand()%n<<endl;
  18. }
Success #stdin #stdout 0.01s 2728KB
stdin
100
stdout
33