I am doing Yahtzee and I need help creating a hold function. can anyone help me?

Recommended Answers

All 5 Replies

What code do you have so far?
What did you try?
What is your hold function supposed to do?
What is it about this hold function that you don't know how to do or can't seem to make to work?
...

>>can anyone help me?
We can answer questions or help you solve a problem, but first, you have to describe the problem, ask a relevant question, and show that you have put effort into solving the problem yourself. Answering the questions above is probably a good way to do that.

Some terms to google, function pointers and arrays. Basically, create a typedef of a function pointer, and create an array of that alias.

void prompts()
{
	gotoxy(42,8);
	cout << "Type your name: ";
	getline(cin,name);
	gotoxy(17,29);
	cout << "Do you want to re-roll? (y/n) ";
	cin >> rollAgain;
	if (rollAgain != 'y')
	{
		gotoxy(17,29);
		cout << "Do you want to save any numbers? (y/n) ";
		cin >> savenum;
		if (savenum != 'y')
		{
			gotoxy(0,28);
			EndofTurn();
		}
		else if (savenum == 'y')
		{
			gotoxy(17,29);
			cout << "What die do you want to save?";
			cin >> Hold[0];
		}
	}
}

Hold[5] is my array. How can I make it to check if the number is held and stored inside the array? I need this for my score function

i also need a code for deleting a single line by clearing it out and replacing it with the next gotoxy

Reread Mike's post and answer his questions. He asked the for a reason.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.