Lab 1 Solution

$29.99 $18.99

Goals Write, compile, and test a program that uses multiple files; upload it to flip for testing; submit it to TEACH Create and use simple makefiles and simple archiving using a zip file Understand how to use multi-dimensional arrays You will create a program that is composed of five files to calculate the determinant of…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

Rate this product

Goals

  • Write, compile, and test a program that uses multiple files; upload it to flip for testing; submit it to TEACH

  • Create and use simple makefiles and simple archiving using a zip file

  • Understand how to use multi-dimensional arrays

You will create a program that is composed of five files to calculate the determinant of a user-entered square matrix. The program will have two functions, each with its own header file and source code (.hpp and .cpp) and a main file to run everything.

The matrix will be square and the size will be 2×2 or 3×3. The first function is readMatrix(). It will have two parameters: a pointer to a 2D array and an integer as the size of the matrix. It will prompt the user to fill a square matrix and store the input into the 2D array. The second function is determinant(). It will have 2 parameters: a 2D array and an integer, which is the size of the square. It will return an integer value with is the determinant of the matrix stored in the 2D array. If you don’t remember or know what a determinant is, go to mathsifun.com.

In the main file, you will create a program that ask users to choose the size of the matrix (2×2 or 3×3), then uses readMatrix() to prompt the user to enter 4 or 9 values to fill the array, calculate the determinant using determinant(), and display both the array and the determinant to the user. The array should not be displayed in a single line but in a square format.

Once your program is working and you have eliminated the bugs, create a makefile to build your program. You do not need a complicated makefile. You can have a single target that just includes what you typed into the command line for testing. Include a second target clean that removes extraneous files such as .o files or a.out.

Finally, you should include all 6 files (5 files + a makefile) into a zip archive. There should be no internal directories, that is, when the file is unzipped, it doesn’t create a folder. You must submit only the zip file in TEACH by the due date.

Grading

  • Programming style: 10%

  • Create the source and header file for readMatrix(): 20%

  • Create the source and header file for determinant(): 20%

  • Create and execute a program using both functions: 20%

  • Create a makefile with targets for your program and clean: 20%

  • Submit all files in zip archive: 10%