Professional Documents
Culture Documents
Objective(s):
To Understand about:
1. Apply Arrays in C++
2. Use of Two Dimensional Array
Enrollment Number: ____________________________
Sample Code :
// CP Lab 09.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
**Provide solution of each task and screenshot of output at the end of that task**
Task 1
Write a program to perform matrix multiplication of m x n matrix. Given the condition if
number of rows of first matrix equal to the number of rows of the second matrix.
Page 3 of 5
Enrollment Number: ____________________________
< Solution and output of Task 1 >
Task 2
Write a C++ Program that computes the sum of two matrices. Each matrix is of 2 rows and 2
columns and will be created from user input.
A= 2 3 + B= 6 7 = C= 8 10
4 5 8 9 12 14
< Solution and output of Task 2 >
Task 3
Write a C++ program that read 12 integer values from user, store values in Matrix of 4 X 3.
Create another Matrix of 4 X 3, divide each element of Matrix1 by five, and store the result in
the Matrix2.
Print Matrix A, with heading shown, correctly spaced.
Print Matrix B, with heading shown, correctly spaced.
Your Program should display output as follows:
Sample Output:
===================================
Matrix A – Original
===================================
18 42 13
38 76 84
24 81 49
12 48 26
Page 4 of 5
Enrollment Number: ____________________________
===================================
Matrix A – Divided by 5
===================================
4 8 3
8 15 17
5 16 10
2 10 5
< Solution and output of Task 3 >
Task 4
Write a C++ program to calculate the result of 8 students of a class and each student takes 5
courses. Following are the rules for result:
1. Each section has 8 students.
2. Each student takes 5 courses.
Marks for each subject of every student must be taken from the user.
Calculate the result of every student:
1. Obtained marks (Sum of all courses marks). Max. marks of each subject are 100
2. Percentage
Hint: Use Three Dimensional Array
< Solution and output of Task 4>
87 75 76
55 67 80
Page 5 of 5