If the user roll a 6, I want it to say this "Password to the secret room is"
1 2 3 4 5 6 7
{
srand(static_cast<unsignedint>(time(0))); //seed random number generator
int randomNumber = rand(); //generate random number
int die = (randomNumber % 6) + 1; // get a number between 1 and 6
cout << "You rolled a " << die << endl;
return 0;
}
{
srand(static_cast<unsignedint>(time(0))); //seed random number generator
int randomNumber = rand(); //generate random number
int die = (randomNumber % 6) + 1; // get a number between 1 and 6
cout << "You rolled a " << die << endl;
if (die == 6)
{
cout << "Password to the secret room is";
}
return 0;
}
or
1 2 3 4 5 6 7 8 9 10 11 12 13 14
{
srand(static_cast<unsignedint>(time(0))); //seed random number generator
int randomNumber = rand(); //generate random number
int die = (randomNumber % 6) + 1; // get a number between 1 and 6
if (die == 6)
{
cout << "Password to the secret room is";
}
else
{
cout << "You rolled a " << die << endl;
}
return 0;
}