From c384a6eec6ef4e9d9cc725a7ef20c0a5baf26f09 Mon Sep 17 00:00:00 2001 From: "Simon V. Lejel" Date: Wed, 7 Feb 2024 20:20:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=BB=20Add=20dice=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/excercises/dice.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/excercises/dice.cc diff --git a/src/excercises/dice.cc b/src/excercises/dice.cc new file mode 100644 index 0000000..d6eace8 --- /dev/null +++ b/src/excercises/dice.cc @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +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; +}