Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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++
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 8Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started