#include choice in format ‘X,Y’ “; cin >> r1

#include “stdafx.h”#include #include #include using namespace std;void Restart(int4);int main(){ char comma, ans = ‘y’; int r1, c1, r2, c2, cards44, i(0); bool CardFlipArray44;    bool Loss = false;  int UserMoves; do { UserMoves = 0; Restart(cards);  cout << "    1 2 3 4 "; cout << "  "; for (int i = 0; i <= 8; i++) { cout << "-"; } cout << endl; for (int r = 0; r<4; r++) { cout << r + 1 << " | "; for (int c = 0; c<4; c++) { cout << "* "; CardFlipArrayrc = false; } cout << endl; } cout << endl; do  { do { cout << "Please select your first choice in format 'X,Y' "; cin >> r1 >> comma >> c1; if (CardFlipArrayr1 – 1c1 – 1 == true)  { cout << "This card has already been selected"; } } while (CardFlipArrayr1 - 1c1 - 1 != false); do { cout << "Please select your second choice in format 'X,Y' "; cin >> r2 >> comma >> c2; if (CardFlipArrayr2 – 1c2 – 1 == true)  { cout << "This card has already been selected"; } if ((r1 == r2) && (c1 == c2)) { cout << "This card has already been selected"; continue; } } while (CardFlipArrayr2 - 1c2 - 1 != false); r1--; c1--; r2--; c2--; cout << "    1 2 3 4 "; cout << "  "; for (int i = 0; i <= 8; i++) { cout << "-"; } cout << endl; for (int r = 0; r<4; r++) { cout << r + 1 << " | "; for (int c = 0; c<4; c++) { if ((r == r1) && (c == c1)) { cout << cardsrc << " "; } else if ((r == r2) && (c == c2)) { cout << cardsrc << " "; } else if (CardFlipArrayrc == true) { cout << cardsrc << " "; } else { cout << "* "; } } cout << endl; } if (cardsr1c1 == cardsr2c2)  { cout << "You have a match!" << endl; CardFlipArrayr1c1 = true; CardFlipArrayr2c2 = true; } cin.get(); cin.get(); for (int b = 0; b <= 20; b++) cout << endl; for (int r = 0; r<4; r++) { cout << r + 1 << " | "; for (int c = 0; c<4; c++) { if (CardFlipArrayrc == true) { cout << cardsrc << " "; } else { cout << "* "; } } cout << endl; } Loss = true; for (int r = 0; r<4; r++)  { for (int c = 0; c<4; c++) { if (CardFlipArrayrc == false) { Loss = false; break; } } if (Loss == false) { break; } } UserMoves++;  } while (Loss != true);  cout << "You WIN" << endl; cout << "Restart? (1= Yes, 2 = No) : "; ans = cin.get(); } while (ans == '1' || ans == '2'); // If user wants to play game again. cin.get(); return 0;}void Restart(int cards4){ int start16 = { 1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8 }; for (int s = 0; s <= 20; s++) { for (int x = 0; x<16; x++) { srand((unsigned)time(NULL)); int i = rand() % 15 + 1; int temp = startx; startx = starti; starti = temp; } } int i = 0; for (int r = 0; r<4; r++) { for (int c = 0; c<4; c++) { cardsrc = starti; cout << cardsrc; i = i + 1; } cout << endl; }}

x

Hi!
I'm Marcella!

Would you like to get a custom essay? How about receiving a customized one?

Check it out