Melden

watchamirpuneFolgen

1. Apr 2023•0 gefällt mir•2 views

1. Apr 2023•0 gefällt mir•2 views

Melden

Bildung

Important This programming assigument is for ALL the students, those who subscribed to zyBooks and those who did not. It contains one problem. - Submit your source code on Moodle. You must name your source file as follows: - For write your code in a file named a5submat.ce - Use source file templatef.cc from the files provided on Moodle to start your program. - The problem is marked out of 10 points. 2 Programming problem P1: A matrix is a two dimensional vector (or a vector of vectors). See https://en.wikipedia.org/ wiki/Matrix_(mathenatics) for a definition. A sub-matrix A of a matrix A is a matrix obtained by retaining elements of A that belong to a subset of rows and columns of A. We consider the rows and columns of A identified by their index. For example, suppose matrix A is a 45 matrix. The leftmost column of A is at index 0 . The rightmost column of A is at index 4. The top row of A is at index 0 and the bottom row of A is at. index 3. Then, the sub-matrix A obtained by selecting rows from 1 to 2 and columns from 1 to 3 is given below. AA=11010010002202002000330300300044040040005505005000=(202003030040400) Write a program that reads a matrix of 'double' values with n rows and m columns from the input. The first two values in the input are the positive integers n and m. Following are nm fractional values for the entries of the matrix. The entries are listed in the input row by row. The last four values in the input are the positive integers r,r+,c,c+, representing the smallest row index, the largest row index, the smallest column index, and the largest column index of the sub-matrix, respectively. For sub-matrix A above, r=1,r+=2,c=1,c+=3. Your program then outputs the sum of the entries in the sub-matrix identified by integers r,r+,c,c+. You may assume that the values for r,r+,c,c+are valid. Do not write any messages before reading your input. Design your output like in the example below. Input: Output: Input: Output:.

- 1. Important This programming assigument is for ALL the students, those who subscribed to zyBooks and those who did not. It contains one problem. - Submit your source code on Moodle. You must name your source file as follows: - For write your code in a file named a5submat.ce - Use source file templatef.cc from the files provided on Moodle to start your program. - The problem is marked out of 10 points. 2 Programming problem P1: A matrix is a two dimensional vector (or a vector of vectors). See https://en.wikipedia.org/ wiki/Matrix_(mathenatics) for a definition. A sub-matrix A of a matrix A is a matrix obtained by retaining elements of A that belong to a subset of rows and columns of A. We consider the rows and columns of A identified by their index. For example, suppose matrix A is a 45 matrix. The leftmost column of A is at index 0 . The rightmost column of A is at index 4. The top row of A is at index 0 and the bottom row of A is at. index 3. Then, the sub-matrix A obtained by selecting rows from 1 to 2 and columns from 1 to 3 is given below. AA=11010010002202002000330300300044040040005505005000=(202003030040400) Write a program that reads a matrix of 'double' values with n rows and m columns from the input. The first two values in the input are the positive integers n and m. Following are nm fractional values for the entries of the matrix. The entries are listed in the input row by row. The last four values in the input are the positive integers r,r+,c,c+, representing the smallest row index, the largest row index, the smallest column index, and the largest column index of the sub-matrix, respectively. For sub-matrix A above, r=1,r+=2,c=1,c+=3. Your program then outputs the sum of the entries in the sub-matrix identified by integers r,r+,c,c+. You may assume that the values for r,r+,c,c+are valid. Do not write any messages before reading your input. Design your output like in the example below. Input: Output: Input: Output: