1. Declare the following macros (i.e. use #define NOT const) to use as global constants for the application a. TRUE as value 1 b. FALSE as value 0 c. NAME as value 20 d. ROW as value 8 e. COL as value 8 f. SPACE as value '' (i.e. there is an explicit space between the open and close single quote) g. PLAYER_X as value 1 h. PLAYER_O as value 2 i. ZERO as value 0 j. ONE as value 1 k. TWO as value 2 1. FOUR as value 4 m. INVALID as value -1 nite the → 4 1. = 2

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
C Programming. Please provide pictures of the code. Thank you very much!
1. Declare the following macros (i.e. use #define NOT const) to use as
global constants for the application
a. TRUE as value 1
b. FALSE as value 0
c. NAME as value 20
d. ROW as value 8
e. COL as value 8
f. SPACE as value ' ' (i.e. there is an explicit space between the
open and close single quote)
g. PLAYER_X as value 1
h. PLAYER_O as value 2
i. ZERO as value 0
j. ONE as value 1
k. TWO as value 2
1. FOUR as value 4
m. INVALID as value -1
2. Write the function declaration or prototype for function playGame
(hint: it is the same function signature of the function with a semi-
colon at the end)
3. Updated the main function to do the following
a. Comment out the call to function displayExplicitBoard; it
will be called from the new function playGame
b. Before the return 0 statement, call function playGame
Transcribed Image Text:1. Declare the following macros (i.e. use #define NOT const) to use as global constants for the application a. TRUE as value 1 b. FALSE as value 0 c. NAME as value 20 d. ROW as value 8 e. COL as value 8 f. SPACE as value ' ' (i.e. there is an explicit space between the open and close single quote) g. PLAYER_X as value 1 h. PLAYER_O as value 2 i. ZERO as value 0 j. ONE as value 1 k. TWO as value 2 1. FOUR as value 4 m. INVALID as value -1 2. Write the function declaration or prototype for function playGame (hint: it is the same function signature of the function with a semi- colon at the end) 3. Updated the main function to do the following a. Comment out the call to function displayExplicitBoard; it will be called from the new function playGame b. Before the return 0 statement, call function playGame
4. Write the function playGame to do the following
a. Return type void
b. Empty parameter list
c. Declare the following variables
i. playerX, data type character array size 20 (i.e. use
macro NAME); used to store the player's name that
will be Player X
ii. playerO, data type character array size 20 (i.e. use
macro NAME); used to store the player's name that
will be Player O
iii. currentPlayer, data type integer; initialize to 1
(i.e. use macro PLAYER_X); ; used to keep track of
the current player
iv. loop, data type integer; initialize to 0 (i.e. use
macro ZERO); used to control the number of loop
iterations
v. Write a printf statement to prompt player X to enter
their name
vi. Write a scanf statement to store player X's name in
variable playerX
vii. Write a printf statement to prompt player O to
enter their name
viii. Write a scanf statement to store player O's name
in variable playerO
ix. Write a printf statement using the entered player
names to play Othello
x. Write a while loop to iterate four times (i.e. use
macro FOUR)
1. Call function display ExplicitBoard
2. If the current player (i.e. currentPlayer) is
Player X (i.e. PLAYER_X)
a. Write a printf statement to tell Player X
it is their turn
b. Switch players by setting current
player to Player O
3. If the current player (i.e. currentPlayer) is
Player O (i.e. PLAYER_O)
a. Write a printf statement to tell Player O
it is their turn
b. Switch players by setting current
player to Player X
4. Call function system(), pass as an argument
explicit text "pause" (i.e. must include
double quotes) to pause the console output
5. Increment the loop control variable (i.e. loop)
by one
Transcribed Image Text:4. Write the function playGame to do the following a. Return type void b. Empty parameter list c. Declare the following variables i. playerX, data type character array size 20 (i.e. use macro NAME); used to store the player's name that will be Player X ii. playerO, data type character array size 20 (i.e. use macro NAME); used to store the player's name that will be Player O iii. currentPlayer, data type integer; initialize to 1 (i.e. use macro PLAYER_X); ; used to keep track of the current player iv. loop, data type integer; initialize to 0 (i.e. use macro ZERO); used to control the number of loop iterations v. Write a printf statement to prompt player X to enter their name vi. Write a scanf statement to store player X's name in variable playerX vii. Write a printf statement to prompt player O to enter their name viii. Write a scanf statement to store player O's name in variable playerO ix. Write a printf statement using the entered player names to play Othello x. Write a while loop to iterate four times (i.e. use macro FOUR) 1. Call function display ExplicitBoard 2. If the current player (i.e. currentPlayer) is Player X (i.e. PLAYER_X) a. Write a printf statement to tell Player X it is their turn b. Switch players by setting current player to Player O 3. If the current player (i.e. currentPlayer) is Player O (i.e. PLAYER_O) a. Write a printf statement to tell Player O it is their turn b. Switch players by setting current player to Player X 4. Call function system(), pass as an argument explicit text "pause" (i.e. must include double quotes) to pause the console output 5. Increment the loop control variable (i.e. loop) by one
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY