CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
//constants for values on 6 side die
const int MIN = 1;
const int MAX = 6;
//our die var
int die;
//our sys time
unsigned s = time(0);
//our seed
srand(s);
cout << "Rolling..." << endl;
//our roll
die = (rand() % (MAX - MIN + 1)) + MIN;
cout << die << endl;
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run