Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main(void)
- {
- // seed with random time
- srand(time(NULL));
- // random number 1 - 6
- int rand_num = rand() % 6 + 1;
- // print number to screen
- cout << "rand num = " << rand_num << endl;
- // pause before exit
- cin.get();
- return 0;
- }
Add Comment
Please, Sign In to add comment