🍻 Add dice example
This commit is contained in:
parent
32c530ced1
commit
c384a6eec6
1 changed files with 19 additions and 0 deletions
19
src/excercises/dice.cc
Normal file
19
src/excercises/dice.cc
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <ctime>
|
||||||
|
#include <iostream>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
|
||||||
|
int minValue = 1;
|
||||||
|
int maxValue = 6;
|
||||||
|
for (short i = 1; i < 3; i++) {
|
||||||
|
srand(time(nullptr));
|
||||||
|
cout << "Dice " << i << ": " << (rand() % (maxValue - minValue)) + minValue << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue