Docsity

CS 145 Programming Assignment 10: Matrices - Prof. Bryon Ehlmann, Assignments of Computer Science

Toggle sidebar
bg1
CS 145—Programming Assignment 10
Due on: Thursday, April 30
Weight: 4%
Complete the program given as Matrices.cpp in the class directory following the specifications given below,. Test your
completed program using the data file matrices.txt, also given in the class directory.
1) Name the project, solution, and final program Matrices<id> where <id> is your (or your partner’s) seat number.
2) Display the line given below before displaying any output, where <id> is as described above.
**** Program Matrices<id> ****
3) The main() function must produce the screen shot as
shown on the right. To do this, declare four matrices.
Input the first three from the matrices.txt file and
display each. Then display the sum of the first two
matrices, the product of the first and third, and the
transpose of the first. Finally, attempt to input and
display the fourth matrix from matrices.txt. The error
as shown should result.
4) Immediately after attempting to read any matrix , test for
file failure and if true, first display the message 'Error
in reading Matrix<matrix#> from file
<external file name>', where <matrix#> is the
number of the matrix (1 to 4) and <external file
name> is the matrices file name entered by the user, and
then exit the program; otherwise, display the matrix
and proceed.
5) Compute the transpose of a matrix as defined in problem
5 on p. 371 of your textbook. Note that your
transpose() function is a const function that returns
the transpose matrix.
On the date the program is due, bring to class a printout
containing the source code for your program. Yours or your
programming partner’s printout—the one whose seat
number was used in naming the program— must also
contain one or more screen shots of the console window
showing the results of executing your program.
Before class on the date the program is due place your program into the dropbox of the student identified by the
<id> used in the program name.

Partial preview of the text

Download CS 145 Programming Assignment 10: Matrices - Prof. Bryon Ehlmann and more Assignments Computer Science in PDF only on Docsity!

CS 145—Programming Assignment 10

Due on: Thursday, April 30 Weight: 4% Complete the program given as Matrices.cpp in the class directory following the specifications given below,. Test your completed program using the data file matrices.txt, also given in the class directory.

  1. Name the project, solution, and final program Matrices where is your (or your partner’s) seat number.
  2. Display the line given below before displaying any output, where is as described above. **** Program Matrices ****
  3. The main() function must produce the screen shot as shown on the right. To do this, declare four matrices. Input the first three from the matrices.txt file and display each. Then display the sum of the first two matrices, the product of the first and third, and the transpose of the first. Finally, attempt to input and display the fourth matrix from matrices.txt. The error as shown should result.
  4. Immediately after attempting to read any matrix , test for file failure and if true, first display the message 'Error in reading Matrix<matrix#> from file ', where <matrix#> is the number of the matrix (1 to 4) and is the matrices file name entered by the user, and then exit the program; otherwise, display the matrix and proceed.
  5. Compute the transpose of a matrix as defined in problem 5 on p. 371 of your textbook. Note that your transpose() function is a const function that returns the transpose matrix. On the date the program is due, bring to class a printout containing the source code for your program. Yours or your

programming partner’s printout—the one whose seat

number was used in naming the program— must also

contain one or more screen shots of the console window showing the results of executing your program.

Before class on the date the program is due place your program into the dropbox of the student identified by the

used in the program name.