Computer programming.docx - Bahria University Lahore Campus Department of Computer Sciences Lab Journal \u201811\u2019(Spring 2020 Course Course Code

Computer programming.docx - Bahria University Lahore Campus...

This preview shows page 1 - 3 out of 4 pages.

Bahria University, Lahore Campus Department of Computer Sciences. Lab Journal ‘11’ (Spring - 2020) Course: Computer Prg. (Lab) Date: 20 th June, 2020. Course Code: CEL-120. Max Marks: 10. Faculty’s Name: Mr. Noman Aslam. Lab Engineer: Mr. Tayyab Mir Name: Syed Faizan Alam Zaidi. Enrollment No: 03-134192- 002 . Section: IT- 1A Objective(s): To Understand about: 1. Apply Arrays in C++ 2. Use of Two and Three Dimensional Array Lab Tasks: 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. Solution: #include <iostream>
Image of page 1
using namespace std; int i, j, k; //global variables. int main() { int n[10][10], m[10][10], result[10][10], row1, col1, row2, col2; cout << "Kindly, Enter the number of 'Rows' & 'Columns' of the first matrix: " ; //Seperate using 'Space'. cin >> row1 >> col1; cout << "Kindly, Enter the number of 'Rows' & 'Columns' of the second matrix: " ; //Seperate using 'Space'. cin >> row2 >> col2; while (col1 != row2) { cout << "-- INVALID INPUT ! --\nColumn of second Matrix isn't equal to the Row of first Matrix.\nKindly, Enter Again! "
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 4 pages?

  • Fall '18
  • Zia Ul Rehman
  • Row, Bahria University, Department of Computer Sciences, Syed Faizan Alam Zaidi, Mr. Noman Aslam

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture