#include <cstdlib>
#include <ctime>
#include <iostream>
struct Dices
{
int one; // Dice One
int two; // Dice Two
};
Dices roll_dices()
{
Dices d;
d.one = std::rand() % 6 + 1;
d.two = std::rand() % 6 + 1;
return d;
}
bool check_double(Dices d)
{
if (d.one == d.two)
return true;
return false;
}
int main()
{
std::srand(std::time(NULL));
Dices d = roll_dices();
std::cout << "You rolled: " << d.one << " and " << d.two << "!\n";
if (check_double(d))
std::cout << "You rolled a double!\n";
}
I2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjdGltZT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IERpY2VzCnsKICAgIGludCBvbmU7IC8vIERpY2UgT25lCiAgICBpbnQgdHdvOyAvLyBEaWNlIFR3bwp9OwoKRGljZXMgcm9sbF9kaWNlcygpCnsKICAgIERpY2VzIGQ7CgogICAgZC5vbmUgPSBzdGQ6OnJhbmQoKSAlIDYgKyAxOwogICAgZC50d28gPSBzdGQ6OnJhbmQoKSAlIDYgKyAxOwogICAgcmV0dXJuIGQ7Cn0KCmJvb2wgY2hlY2tfZG91YmxlKERpY2VzIGQpCnsKICAgIGlmIChkLm9uZSA9PSBkLnR3bykKICAgICAgICByZXR1cm4gdHJ1ZTsKCiAgICByZXR1cm4gZmFsc2U7Cn0KCmludCBtYWluKCkKewogICAgc3RkOjpzcmFuZChzdGQ6OnRpbWUoTlVMTCkpOwoKICAgIERpY2VzIGQgPSByb2xsX2RpY2VzKCk7CgogICAgc3RkOjpjb3V0IDw8ICJZb3Ugcm9sbGVkOiAiIDw8IGQub25lIDw8ICIgYW5kICIgPDwgZC50d28gPDwgIiFcbiI7CgogICAgaWYgKGNoZWNrX2RvdWJsZShkKSkKICAgICAgICBzdGQ6OmNvdXQgPDwgIllvdSByb2xsZWQgYSBkb3VibGUhXG4iOwp9Cg==