Computer Science Using C++

Ch. 15 Programming Assignment

Write a C++ program that computes and displays the determinants of 3 separate 3 by 3 matrices. The data must be read from a file named Ch15Proj1data.txt. The data in Ch15Proj1data.txt will consist of 9 lines of data with 3 integer values per line separated by a single space. See this hyperlink for a sample Ch15Proj1data.txt file. Your program must use a function named det3 that receives an argument that is a 3 x 3 apmatrix of integers. The function det3 must return the integer determinant of the passed apmatrix. Your program must determine which of the 3 separate matrices has the largest determinant. The program must neatly display that matrix along with its determinant.

Your program must be as efficient as possible, using loops, apvectors, and/or apmatrices appropriately. You may also create and use other functions besides det3. Be sure to pass parameters appropriately with regard to speed, memory usage, and safety. Do not use any global variables unless you have the permission of the instructor. If necessary, see the instructor or Internet resources for help with the actual computation of a 3 x 3 matrix determinant. Note that you can easily use Excel or this Web site to test your program since it has a determinant function.

Your program must follow the Wyo Area Comp Sci Documentation & Coding Standards. Place a copy of Ch15Proj1.cpp in your Submit folder so that the instructor can execute your program within that folder. Make sure that the program successfully opens a Ch15Proj1data.txt test file that the instructor could modify if desired. Be sure that any #include compiler directives have valid paths so that the instructor will not have linking errors.

Preconditions:

You must hand in the following on separate pages stapled in this specified order:

    1. The hardcopy source code for this assignment. Staple multiple pages together, if applicable.
    2. The typed pseudocode that you used to write out your C++ code. Please type this neatly following the specified template.

Computer Science Using C++ Home Page | Mr. Minich's Wyo Home Page