Question
CODED IN C++ -Prompt the user to enter five integer numbers (Range: one through six inclusive on both ends) -Each time the user enters a
CODED IN C++
-Prompt the user to enter five integer numbers (Range: one through six inclusive on both ends)
-Each time the user enters a valid number, place it into a multiset of integers -Create and use a set of integers with your data to determine if it is a Yahtzee! (5 of a kind)
-Create this set and also create a map of integer keys and integer values to determine the rest of the possible results:
-Display to the user the best of the six possible results that they have achieved with the result of their turn 5 of a kind (Ordered best to worst) 4 of a kind Full house (3 of a kind plus a pair) 3 of a kind, Large straight, Small straight, or Nothing
I HAVE CODE ALREADY BUT NEED HELP FINISHING LAST 2 STEPS!
#include
#include
#include
bool isYahtzee(std::multiset
{
for (auto iter = yahtzeSet.begin(); iter != yahtzeSet.end(); ++iter)
{
if (yahtzeSet.find(*iter) == yahtzeSet.end())
{
return false;
}
}
return true;
}
void results(std::map
{
std::map
std::pair
for(it = yatze.begin(); it != yatze.end(); it++)
{
}
}
int main()
{
int num1;
int num2;
int num3;
int num4;
int num5;
std::multiset
std::cout << "Enter a number between 1 and 6: ";
std::cin >> num1;
yahtze.insert(num1);
std::cout << "Enter a number between 1 and 6: ";
std::cin >> num2;
yahtze.insert(num2);
std::cout << "Enter a number between 1 and 6: ";
std::cin >> num3;
yahtze.insert(num3);
std::cout << "Enter a number between 1 and 6: ";
std::cin >> num4;
yahtze.insert(num4);
std::cout << "Enter a number between 1 and 6: ";
std::cin >> num5;
yahtze.insert(num5);
std::cout << std::endl;
isYahtzee(yahtze);
if (!isYahtzee)
std::cout << "YAHTZEE!!!! " << std::endl;
std::map
std::make_pair(2,num2),
std::make_pair(3,num3),
std::make_pair(4,num4),
std::make_pair(5,num5)};
//results(combinations);
system("Pause");
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started