Archived
1
0
Fork 0

🍻 Add dice example

This commit is contained in:
Simon V. Lejel 2024-02-07 20:20:28 +01:00
parent 32c530ced1
commit c384a6eec6
Signed by: sl
GPG key ID: 6544A0430A2CFFAD

19
src/excercises/dice.cc Normal file
View 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;
}