You will be creating a simple version of Game of Life.. Write a

Added on - 19 Sep 2019

  • 1

    pages

  • 340

    Words

  • 70

    Views

  • 0

    Downloads

Showing pages 1 to 1 of 1 pages
You will be creating a simple version of Game of Life.Write a C++ program that tests the function main and the functions discussed in steps1 through 7.1. Declare two global variables:const int MAX_COL = 60;const int MAX_ROW = 30;2. Declare 2 two-dimensional arrays of type int using the size specified in step 1.currentArrayandtempArray3. Write the definition of the functiondisplayMenuthat displays the following menu.[P]lay – Press 'P' to play.[Q]uit – Press 'Q' to exit.4. Write the definition of the functionsetZeroArraythat initializes any two-dimensional array of typeint to 0.5. Write the definition of the functionsetInitialPatternArraythat creates the pattern of ‘U’ using ‘1’ inany two-dimensional array of type int. The following shows a portion of an array. Use thepredefinedrand()function to determine the row and column of the first1(bold).0000000000100000100100000100100000100100000100100000100111111100000000006. Write the definition of the functioncopyArraythat copy a two-dimensional array to another two-dimensional array.7. Write the definition of the functiondisplayArraythat prints any two-dimensional array of type int.8. When executing your program, the following should happen:a. Print the menu using thedisplayMenufunction.b. Initialize thetempArrayusing thesetZeroArrayfunction.c. Set the ‘U’ pattern in thetempArrayusing thesetInitialPatternArrayfunction.d. Copy thetempArrayto thecurrentArrayusing thecopyArrayfunction.e. Print thecurrentArrayusing thedisplayArrayfunction.f. When the user presses ‘P’, you will repeatathrougheonlyonce.When the user presses ‘Q’, it will terminate the program.Make sure that it compiles using Code::Blocks.
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Download This Document