|
@@ -0,0 +1,56 @@
|
|
|
+#include <string>
|
|
|
+#include <vector>
|
|
|
+class Dice {
|
|
|
+ public:
|
|
|
+ int white1, white2, red, yellow, green, blue;
|
|
|
+ int roll();
|
|
|
+ void print();
|
|
|
+};
|
|
|
+int Dice::roll() {
|
|
|
+ std::vector<int> output;
|
|
|
+
|
|
|
+ for (int i = 0; i<6; i++) {
|
|
|
+
|
|
|
+ output.push_back((rand() % 6) + 1);
|
|
|
+ }
|
|
|
+ white1 = output[0];
|
|
|
+ white2 = output[1];
|
|
|
+ red = output[2];
|
|
|
+ yellow = output[3];
|
|
|
+ green = output[4];
|
|
|
+ blue = output[5];
|
|
|
+ return 15;
|
|
|
+}
|
|
|
+void Dice::print() {
|
|
|
+ fprintf (stdout, "White1 Dice: %d\n", white1);
|
|
|
+ fprintf (stdout, "White2 Dice: %d\n", white2);
|
|
|
+ fprintf (stdout, "Yellow Dice: %d\n", yellow);
|
|
|
+ fprintf (stdout, "Red Dice: %d\n", red);
|
|
|
+ fprintf (stdout, "Blue Dice: %d\n", blue);
|
|
|
+ fprintf (stdout, "Green Dice: %d\n", green);
|
|
|
+}
|
|
|
+
|
|
|
+humphe = new Dice();
|
|
|
+humphe.rollDice();
|
|
|
+
|
|
|
+fprintf(stdout, "the red die %d\n", humphe.red);
|
|
|
+
|
|
|
+
|
|
|
+struct SDie {
|
|
|
+ int number;
|
|
|
+ std::string color;
|
|
|
+};
|
|
|
+
|
|
|
+class CDie {
|
|
|
+ int number; std::string color;
|
|
|
+ int roll();
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+SDie greebDie = {1, "brellow"};
|
|
|
+
|
|
|
+CDie yellowDie;
|
|
|
+yellowDie = newC Die();
|
|
|
+yellowDie.number = 1;
|
|
|
+yellowDie.color = "preple";
|
|
|
+yellowDie.roll(); */
|