0% found this document useful (0 votes)
41 views4 pages

CS-114 Fundamentals of Programming (2+1) DE-41 EE Semester 1 Fall 2019

This lab report details Task 1 on variable declaration for a programming fundamentals course, which involves multiplying two matrices by defining functions to accept matrix data as input, perform the multiplication calculation, and display the results, with the code demonstrating how to declare and use variables to store matrix dimensions and values throughout the process.

Uploaded by

Bakhat Baidar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views4 pages

CS-114 Fundamentals of Programming (2+1) DE-41 EE Semester 1 Fall 2019

This lab report details Task 1 on variable declaration for a programming fundamentals course, which involves multiplying two matrices by defining functions to accept matrix data as input, perform the multiplication calculation, and display the results, with the code demonstrating how to declare and use variables to store matrix dimensions and values throughout the process.

Uploaded by

Bakhat Baidar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CS-114 Fundamentals of Programming (2+1)

DE-41 EE Semester 1
Fall 2019

LAB REPORT # 01

Submitted by Roll No

NAME -
Syndicate (A) -

Instructor In-charge: Dr. Saad Rehman

DEPARTMENT OF COMPUTER & SOFTWARE ENGINEERING


College of Electrical and Mechanical Engineering (CEME)
National University of Sciences and Technology (NUST)
Lab Number: 1
Lab Title: Variable Declaration
Aim:

Topic(s) covered:

(Tasks starting from next page)


TASK 1:

Code:
#include <iostream>
using namespace std;

void enterData(int firstMatrix[][10], int secondMatrix[][10], int rowFirst, int


columnFirst, int rowSecond, int columnSecond);
void multiplyMatrices(int firstMatrix[][10], int secondMatrix[][10], int
multResult[][10], int rowFirst, int columnFirst, int rowSecond, int columnSecond);
void display(int mult[][10], int rowFirst, int columnSecond);

int main()
{
int firstMatrix[10][10], secondMatrix[10][10], mult[10][10], rowFirst,
columnFirst, rowSecond, columnSecond, i, j, k;

cout << "Enter rows and column for first matrix: ";
cin >> rowFirst >> columnFirst;

cout << "Enter rows and column for second matrix: ";
cin >> rowSecond >> columnSecond;

// If colum of first matrix in not equal to row of second matrix, asking user
to enter the size of matrix again.
while (columnFirst != rowSecond)
{
cout << "Error! column of first matrix not equal to row of second." <<
endl;
cout << "Enter rows and column for first matrix: ";
cin >> rowFirst >> columnFirst;
cout << "Enter rows and column for second matrix: ";
cin >> rowSecond >> columnSecond;
}

// Function to take matrices data


enterData(firstMatrix, secondMatrix, rowFirst, columnFirst, rowSecond,
columnSecond);

// Function to multiply two matrices.


multiplyMatrices(firstMatrix, secondMatrix, mult, rowFirst, columnFirst,
rowSecond, columnSecond);

// Function to display resultant matrix after multiplication.


display(mult, rowFirst, columnSecond);

system("pause");
return 0;
}
Output:

You might also like