C++ Yahtzee Game [on hold]
up vote
0
down vote
favorite
I am trying to create a simple yahtzee game that allows for users to input their rolls of the dice from there i put the numbers on a set and have to declare if that set has all 5 of the same values, if so then yahtzee! do not know why mine it not working.
After that the values are put into a map with int key and int value, HOW DO I DETERMINE OTHER RESULTS FROM A MAP? i.e. 3 of a kind, 4 of a kind, large straight, small straight, and full house.
bool isYahtzee(std::multiset<int>& yahtzeSet)
{
for (auto iter = yahtzeSet.begin(); iter != yahtzeSet.end(); ++iter)
{
if (yahtzeSet.find(*iter) != yahtzeSet.end())
{
return false;
}
}
return true;
}
void results(std::map<int, int, std::less<>>& yatze)
{
std::map<int, int>::iterator it;
std::pair<int, int> 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 <int> 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!!!!n" << std::endl;
std::map<int, int, std::less<>> 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;
}
c++ game
New contributor
put on hold as off-topic by Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
0
down vote
favorite
I am trying to create a simple yahtzee game that allows for users to input their rolls of the dice from there i put the numbers on a set and have to declare if that set has all 5 of the same values, if so then yahtzee! do not know why mine it not working.
After that the values are put into a map with int key and int value, HOW DO I DETERMINE OTHER RESULTS FROM A MAP? i.e. 3 of a kind, 4 of a kind, large straight, small straight, and full house.
bool isYahtzee(std::multiset<int>& yahtzeSet)
{
for (auto iter = yahtzeSet.begin(); iter != yahtzeSet.end(); ++iter)
{
if (yahtzeSet.find(*iter) != yahtzeSet.end())
{
return false;
}
}
return true;
}
void results(std::map<int, int, std::less<>>& yatze)
{
std::map<int, int>::iterator it;
std::pair<int, int> 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 <int> 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!!!!n" << std::endl;
std::map<int, int, std::less<>> 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;
}
c++ game
New contributor
put on hold as off-topic by Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to create a simple yahtzee game that allows for users to input their rolls of the dice from there i put the numbers on a set and have to declare if that set has all 5 of the same values, if so then yahtzee! do not know why mine it not working.
After that the values are put into a map with int key and int value, HOW DO I DETERMINE OTHER RESULTS FROM A MAP? i.e. 3 of a kind, 4 of a kind, large straight, small straight, and full house.
bool isYahtzee(std::multiset<int>& yahtzeSet)
{
for (auto iter = yahtzeSet.begin(); iter != yahtzeSet.end(); ++iter)
{
if (yahtzeSet.find(*iter) != yahtzeSet.end())
{
return false;
}
}
return true;
}
void results(std::map<int, int, std::less<>>& yatze)
{
std::map<int, int>::iterator it;
std::pair<int, int> 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 <int> 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!!!!n" << std::endl;
std::map<int, int, std::less<>> 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;
}
c++ game
New contributor
I am trying to create a simple yahtzee game that allows for users to input their rolls of the dice from there i put the numbers on a set and have to declare if that set has all 5 of the same values, if so then yahtzee! do not know why mine it not working.
After that the values are put into a map with int key and int value, HOW DO I DETERMINE OTHER RESULTS FROM A MAP? i.e. 3 of a kind, 4 of a kind, large straight, small straight, and full house.
bool isYahtzee(std::multiset<int>& yahtzeSet)
{
for (auto iter = yahtzeSet.begin(); iter != yahtzeSet.end(); ++iter)
{
if (yahtzeSet.find(*iter) != yahtzeSet.end())
{
return false;
}
}
return true;
}
void results(std::map<int, int, std::less<>>& yatze)
{
std::map<int, int>::iterator it;
std::pair<int, int> 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 <int> 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!!!!n" << std::endl;
std::map<int, int, std::less<>> 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;
}
c++ game
c++ game
New contributor
New contributor
New contributor
asked yesterday
Brenden Hartdegen
1
1
New contributor
New contributor
put on hold as off-topic by Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes