Starting from:
$26.99

$20.99

Lab #1 Solution

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. The program will have two functions, each with it’s own header file and source code (think .cpp and .hpp) and a main file to run everything.

 

The first function is readMatrix().   It will have a pointer to a 2D array and an integer as parameters.  The integer is the size of the square.  It will prompt the user to fill a square matrix. For this lab the matrix will be 2x2 or 3x3.

 

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.  If you don’t remember or know what a determinant is remember mathsifun.com!

 

In the main file, you will create a program that 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.

 

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 into a zip archive.  There should be no internal directories, aka, when the file is unzipped, it doesn’t create a folder.  You must submit only the zip file in TEACH by the due date. Only submissions that are in a single zipped file, that include the makefile, that are submitted to TEACH, will be accepted.

 

 

    

Programming style- 1 point


Grading  

 

Create the source and header file for readMatrix()- 2 points Create the source and header file for determinant()- 2 points Create and execute a program using both functions- 2 points

Create a makefile with targets for your program and clean - 2 points

 

Submit all files in zip archive- 1 point

More products