subject

Need with this c++ program.

use the following multi-dimension array declaration in main() to create the simplifiedtwo player tic-tac-toe game (see notes below for important game variation)

int ttt[3][3] = { { 0,0,0 }, { 0,0,0 }, { 0,0,0 } }; //int ttt[3][3] = { 0 }; alternate way to code this!

your program should implement and use the following functions –

void render(int arr[3][3]);

displays the current state of the tic-tac-toe game in simple grid form.

void currentmove(int arr[3][3], int row, int col, int value);

updates the array with a value at the given row and col position(presumably 1 or 2). no validation is required (i. e. existing moves can beoverwritten).

int checkwin(int arr[3][3]); returns the winner as an int (i. e. 1, 2, or 0 if there is no winner yet)

or if you prefer (or another arrangement that can determine the winner) - bool checkplayer1(int arr[3][3]); bool checkplayer2(int arr[3][3]);

returns true if respective player wins, false if not. this maybe a little easier to program and implement than checkwin.

notes: main() should prompt players 1 and 2 to input column and row values (and renderthe results) until a winner is detected. a major change from traditional tic-tac-toe rules isthat there is no validation or prohibition against a player selecting a cell alreadyselected. the program simply keeps track of moves (and renders them), and checks for awinner (with no move validation). you of course are welcome to validate moves if youlike (but this raises the additional issue of determining when a ‘cats’ game occurs which is beyond the required scope of this project).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
Answers: 2
question
Computers and Technology, 24.06.2019 07:00
Why would a business likely use a java applet - to back up their data files for the business - to create a program that a customer can launch in their web browser - to create music on a powerpoint presentation - to organize files on their company directory
Answers: 3
question
Computers and Technology, 25.06.2019 03:10
Write a program to convert a person's height in inches into centimetres #and their weight in stones into kilograms. (1 inch = 2.54 cm and 1 stone = 6.364 kg)
Answers: 1
You know the right answer?
Need with this c++ program.

use the following multi-dimension array declaration in mai...
Questions
question
Mathematics, 03.02.2020 13:56
question
Mathematics, 03.02.2020 13:56
question
Business, 03.02.2020 13:56
question
Mathematics, 03.02.2020 13:56
Questions on the website: 13722361