+ 2
How to do domino game in class ?
I want to do class named domino take two dots (left , right), and have function disallowed to print the inverse of two dots raken before. Example : if user input two dots 2 , 4 ,the function disallowed to input 4 , 2. this is my code, i tried to set all probabilities in an array and delete every two dots that the user will input them. https://code.sololearn.com/cjF8h39YM1yL/?ref=app
5 odpowiedzi
+ 1
There are a couple errors that prevent your code from executing. The 'int arr[36]' has more than 36 integers. One way of fixing this would be to increase the number 36 to the number of integers you declared.
But I honestly don't know what your objective is.
+ 1
ok, i will fixed this error that i will increase the size of array,
my objective is if the user input two dots ,he can't input them again, if you have another idea give me please.
0
The game of dominos is played using pieces that are usually black rectangles with some number of white dots on each side. For example, the domino is called the 4-1 domino, with four dots on its left side and one on its right. Define a simple Domino class that represents a traditional domino. Your class should export the following entries: • A default constructor that creates the 0-0 domino • A constructor that takes the number of dots on each side • A toString method that creates a string representation of the domino • Two getter methods named getLeftDots and getRightDots All instance variables should be private to the class. Write the domino.h interface and the domino.cpp implementation that export this class. As with the examples in the text, the interface should overload the << operator so that it is possible to print the string representation of a domino on any output stream. Test your implementation of the Domino class by writing a program that creates a full set of dominos from 0-0 up to 6-6
0
and then displays those dominos on the console. A full set of dominos contains one copy of each possible domino in that range, disallowing duplicates that result from flipping a domino over. A domino set, therefore, has a 4-1 domino but not a separate 1-4 domino.
0
language is small tough