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& yahtzeSet)

{

for (auto iter = yahtzeSet.begin(); iter != yahtzeSet.end(); ++iter)

{

if (yahtzeSet.find(*iter) == yahtzeSet.end())

{

return false;

}

}

return true;

}

void results(std::map& yatze)

{

std::map::iterator it;

std::pair result = *yatze.begin();

for(it = yatze.begin(); it != yatze.end(); it++)

{

}

}

int main()

{

int num1;

int num2;

int num3;

int num4;

int num5;

std::multiset yahtze;

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 combinations{ std::make_pair(1,num1),

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!