Guest User

Untitled

a guest
Feb 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. int main(void)
  8. {
  9.     // seed with random time
  10.     srand(time(NULL));
  11.  
  12.     // random number 1 - 6
  13.     int rand_num = rand() % 6 + 1;
  14.  
  15.     // print number to screen
  16.     cout << "rand num = " << rand_num << endl;
  17.  
  18.     // pause before exit
  19.     cin.get();
  20.     return 0;
  21. }
Add Comment
Please, Sign In to add comment