Question: In this program, you will check whether two dominoes match. Three dominoes. The first domino has a 1 on the left and a 5 on

In this program, you will check whether two dominoes match.
Three dominoes. The first domino has a 1 on the left and a 5 on the right. The third domino has a 3 on the left and 2 on the right. The second domino has a 5 touching the 5 on the first domino and a 3 touching the 3 on the third domino.
Because you can flip a tile, two tiles match if the number on the left or right matches the left or right on the other tile. For example, the domino 2|1 maches the domino 1|3 without flipping either, and 2|1 matches 2|3 after flipping the first domino.
You should print all matches. First check a direct match, then try flipping tiles. But dont flip a tile whose left and right numbers are the same. If there is no match, print "No match".
Don't restructure the code. Fill in a condition for each of the if (/* Your code goes here */) statements.#include
using namespace std;
int main()
{
cout << "First domino: "<< endl;
int left1; cin >> left1;
int right1; cin >> right1;
cout << "Second domino: "<< endl;
int left2; cin >> left2;
int right2; cin >> right2;
bool matched = false;
/* Your code goes here */
if (/* Your code goes here */)
{
cout << "Match without flipping" << endl;
matched = true;
}
if (/* Your code goes here */)
{
cout << "Match after flipping first domino" << endl;
matched = true;
}
if (/* Your code goes here */)
{
cout << "Match after flipping second domino" << endl;
matched = true;
}
if (/* Your code goes here */)
{
cout << "Match after flipping both dominos" << endl;
matched = true;
}
if (/* Your code goes here */)
{
cout <<"No match" << endl;
}
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!