Question: C++ Exercise 6: Two-dimensional arrays are good structures to represent boards in games. Write a function that takes a two-dimensional array as input and marks

C++C++ Exercise 6: Two-dimensional arrays are good structures to represent boards in

Exercise 6: Two-dimensional arrays are good structures to represent boards in games. Write a function that takes a two-dimensional array as input and marks the array as a checkerboard. Put an asterisk in the black squares and a blank in the white squares. Write a second function that prints the checkerboard on the screen. Because a checkerboard is a fixed size, the dimensions of the board may be set as constants and accessed nonlocally Exercise 7: Write a program that keeps track of stock prices for five stocks for one week. Choose any five stocks on the New York Stock Exchange. Use actual stock prices for one week as your data. Include either clippings from the newspaper or printouts of the data from the Web with your program. Your program should be interactive. Prompt the user to enter the names of the five stocks. Then prompt the user to enter a week's worth of prices for each stock. The program should print a table, showing the input in tabular form; a table showing the average price of each stock for the week; and the average value of all five stocks for each day. You may assume that you have 100 shares of each stock. Exercise 8: A two-dimensional array is the ideal structure to represent a matrix. Write the following functions, which implement the matrix operations add and subtract. To test your operations, you need a function to read values from a file and store them in a matrix and a function to write the values in a matrix on a file. Let your matrices be 5 by 4 in size. Arrays 279 Takes two matrices (A and B) as input and returns a matrix (Result) in which each position is the sum of the corresponding positions in A and B. Add Takes two matrices (A and B) as input and returns a matrix (Result) in which each position is the corresponding position in A minus the corresponding position in B. Sub Takes a file name and a matrix as input and writes the matrix by row, one row per line on the file. Write GetMat Takes a file name and a matrix as input and reads values from the file and stores them into the matrix. Exercise 9: Write and implement a test plan for the matrix operations you wrote in Exercise 8 Exercise 6: Two-dimensional arrays are good structures to represent boards in games. Write a function that takes a two-dimensional array as input and marks the array as a checkerboard. Put an asterisk in the black squares and a blank in the white squares. Write a second function that prints the checkerboard on the screen. Because a checkerboard is a fixed size, the dimensions of the board may be set as constants and accessed nonlocally Exercise 7: Write a program that keeps track of stock prices for five stocks for one week. Choose any five stocks on the New York Stock Exchange. Use actual stock prices for one week as your data. Include either clippings from the newspaper or printouts of the data from the Web with your program. Your program should be interactive. Prompt the user to enter the names of the five stocks. Then prompt the user to enter a week's worth of prices for each stock. The program should print a table, showing the input in tabular form; a table showing the average price of each stock for the week; and the average value of all five stocks for each day. You may assume that you have 100 shares of each stock. Exercise 8: A two-dimensional array is the ideal structure to represent a matrix. Write the following functions, which implement the matrix operations add and subtract. To test your operations, you need a function to read values from a file and store them in a matrix and a function to write the values in a matrix on a file. Let your matrices be 5 by 4 in size. Arrays 279 Takes two matrices (A and B) as input and returns a matrix (Result) in which each position is the sum of the corresponding positions in A and B. Add Takes two matrices (A and B) as input and returns a matrix (Result) in which each position is the corresponding position in A minus the corresponding position in B. Sub Takes a file name and a matrix as input and writes the matrix by row, one row per line on the file. Write GetMat Takes a file name and a matrix as input and reads values from the file and stores them into the matrix. Exercise 9: Write and implement a test plan for the matrix operations you wrote in Exercise 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!