g Fundamentals Assignment 2 Trimester 2, 2017/2018 REMEMBER JAQK Introduction Te
ID: 3875440 • Letter: G
Question
g Fundamentals Assignment 2 Trimester 2, 2017/2018 REMEMBER JAQK Introduction Technologies nowadays have really become part of people's lives. People are heavily relying on technologies like Google Search for information, Google Map for locations and directions, and Facebook for social networking. With these technologies, people can afford not to remember the information they have read, the locations of places they have been before, or even the birthdays of their friends and relatives, because these information can be obtained or retrieved thanks to these technologies. William, a health minister of a new country Machindia, is very worried that such heavy reliance on technology might have negative impact on the health of brain memory. He is concemed that people especially the new generation are using too little of their brain memory, causing the memory cells to deteriorate over time. As people grow old, they might develop neurological disorders that would affect their daily activities. Having an increasing population suffering from neurological disorders is a big issue to his country To prevent such alarming issue, William proposes Remember JAQK, a two-player tun-based card game to encourage people to exercise their brain memory in an entertaining way. This game aims to improve the players' memory, observation, and concentration. He is looking for an aspiring programmer to develop this game in C++ Mission You are to develop Remember JAQK game using C++ based on Problem Description and Program Requirements belowExplanation / Answer
the below is the example code is useful so far
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
char comma;
int r1, c1, r2, c2, cards[4][4];
srand((unsigned)time(NULL));
//fill board
for (int r=0; r<4; r++)
{
for (int c=0; c<4; c++)
{
cards[r][c]=rand()%8+1;
cout<<cards[r][c];
}
cout<<endl;
}
//display board
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<<"* ";
}
cout<<endl;
}
cout<<endl;
//selection
cout<<"Please insert the first card row and column seperated by a comma. ";
cin>>r1>>comma>>c1;
cout<<"Please insert the second card row and column seperated by a comma. ";
cin>>r2>>comma>>c2;
//fix
r1--;
c1--;
r2--;
c2--;
//reveal
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<<cards[r][c]<<" ";
}
else if((r==r2)&&(c==c2))
{
cout<<cards[r][c]<<" ";
}
else
{
cout<<"* ";
}
}
cout<<endl;
}
//match?
if (cards[r1][c1]==cards[r2][c2])
{
}
else
{
}
//this pushes the next board onto a blank screen
for (int b=0; b<=20; b++)
cout<<endl;
//repeat
return 0;
}
Edit & Run
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.