Assignment No.  2
Semester: Spring 2021

CS201
– Introduction to Programming

Total Marks: 20

Due Date:

8th
June 2021


Instructions

Please read the following instructions carefully before submitting
assignment:

It should be
clear that your assignment will not get any credit if:

 

o       
Assignment is
submitted after due date.

o       
Submitted assignment
does not open or file is corrupt.

o       
Assignment is copied
(From internet/students). 


 

Software allowed to develop Assignment

 Dev C++

$ads={1}

Objectives:

In this assignment, the students will learn:

  • How to fill a two-dimensional array
    using given data.

  • How to write user defined functions and
    pass an array to them as parameter.

  • How to use if statement and while loop.

  • How to display array elements.

 

Assignment Submission Instructions

You are required to submit only .cpp file on the assignments interface of CS201 at VU-LMS. Assignment submitted in any other format
will not be accepted and will be graded zero marks.
So, check your solution file format before submission.

 

For any query related to
assignment, please contact cs201@vu.edu.pk.

 

 

                                           
Lectures: 7 to 15

Problem Statement

A matrix is
given in source data. You have to write user defined functions and create a
menu in C++ keeping in mind the following requirements:

  1. Press
    1 to display the matrix and its transpose.

(Hint: Transpose of a
matrix can be achieved by changing its rows into columns or columns into rows.)

    1. Press
      2 to find adjoint and determinant of the matrix.

(Hint: To find adjoint
of a matrix, we change the places of its diagonal elements and the signs of
non-diagonal elements; To find determinant of matrix, we subtract the product
of non-diagonal elements from the product of diagonal elements.)

    1. Press
      any other key to exit.

 

Source data:

(Use
two dimensional array to store following matrix)


















 

Instructions
to write C++ program:

 

Ø 
Write functions to display the matrix; find
transpose, adjoint and determinant of the matrix. Following function names
should be used for consistency.

$ads={2}

To display matrix

showMatrix( );

To show transpose

showTranspose ( );

To show adjoint

showAdjoint();

To find determinant

calculateDeterminant();

 

DOWNLOAD

 

Sample Output:

1)     
When 1 is pressed

1)     
When 2 is pressed

1)     
When any other key is pressed

Lectures Covered:  This assignment
covers Lecture #
07-15.

Deadline:
The
deadline to submit your assignment solution is
8th
June 2021
. Your assignment must be submitted within the due date
through VU-LMS. No assignment will be accepted through email after the due
date.

Facebook
Twitter
LinkedIn
WhatsApp

Leave a Reply

Your email address will not be published. Required fields are marked *