1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #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);
- }
|