Topic: Matrix Calculator
Academic Year: 2025–26
DEPARTMENT OF COMPUTER SCIENCE
RAMANUJ GUPTA SENIOR SECONDARY SCHOOL
Submi ed By: Ayush Babu Sinha
Class: H.S. 2nd Year
Roll No: 6033
Submi ed To:
◈CERTIFICATE◈
This is to certify that the project work entitled
Matrix Calculator submitted by
Ayush Babu Sinha bearing Roll 00.
No. 0000 Registration No.0000 for
The partial ful ilment of H.S. Final Examination 2025-26 is
done by him/her in the computer laboratory during the year
2025 -26. It is also certi ied that the candidate has complied
all the formalities as per the requirement of AHSEC
curriculam.
Principal Lecturer
Ramanuj Gupta Senior Secondary School Department Of Computer Science
Silchar Ramanuj Gupta Senior Secondary School
Sichar
◈Acknowledgement◈
I WOULD LIKE TO EXPRESS MY SINCERE GRATITUDE
TO MY COMPUTER SCIENCE MENTOR FOR HER VITAL
SUPPORT, GUIDANCE AND ENCOURAGEMENT —
WITHOUT WHICH THIS PROJECT WOULD NOT HAVE
COME FORTH. I WOULD ALSO LIKE TO EXPRESS MY
GRATITUDE TO ALL MY GROUP MATES FOR THEIR FULL
SUPPORT AND COOPERATION DURING THE EXECUTION
OF THE PROJECT WORK.
◈Contents◈
CHAPTERS: PAGE NO:
1.OVERVIEW OF C++ 1
2.ABOUT THE PROJECT 2
3.SOURCE CODE 3-7
4.USER MANUAL 8
5.OUTPUT SCREENSHOT OF
MAJOR FEATURES 9
6.BIBLIOGRAPHY 10
OVERVIEW OF C++
C++ IS AN EXTENSION OF C LANGUAGE WHICH IS WIDELY USED ALL OVER.
IT IS A POWERFUL MODERN LANGUAGE THAT COMBINES THE POWER,
ELEGANCE AND FLEXIBILITY OF C AND THE FEATURES OF OBJECT
ORIENTED PROGRAMMING. WITH ITS OBJECT ORIENTED CAPABILITIES
SUCH AS DATA ABSTRACTION, INHERITANCE AND POLYMORPHISM, C++
OFFERS SIGNIFICANT SOFTWARE ENGINEERING BENEFITS OVER C++.
C++ IS WIDELY USED IN THE SOFTWARE INDUSTRY, AND REMAINS ONE OF
THE MOST POPULAR LANGUAGES EVER CREATED. SOME OF ITS
APPLICATION DOMAINS INCLUDE SYSTEM SOFTWARE, APPLICATION
SOFTWARE, DEVICE DRIVERS, EMBEDDED SOFTWARE, HIGH-
PERFORMANCE SERVER AND CLIENT APPLICATIONS, AND
ENTERTAINMENT SOFTWARE SUCH AS VIDEO GAMES.
Page-1
ABOUT THE PROJECT
THIS PROJECT IS BASED ON A MATRIX CALCULATOR
PROGRAM. IN THIS PROJECT WE HAVE SHOWN THE BASIC
FUNCTIONS OF A MATRIX CALCULATOR LIKE ADDITION,
SUBSTRACTION AND MULTIPLICATION OF MATRIX. THIS
PROGRAM SUPPORTS ALL TYPE OF MATRIX FORMATS .
THROUGH THIS WE CAN PERFORM ADDITION SUBSTRACTION
AND MULTIPLICATION OF MATRIX.
Page-2
SOURCE CODE
#include <iostream>
using namespace std;
class Matrix {
public:
int rows, cols;
int mat[10][10];
void input() {
cout << "Enter elements of " << rows << "x" << cols << " matrix:\n";
for (int i = 0; i < rows; ++i)
for (int j = 0; j < cols; ++j)
cin >> mat[i][j];
}
void display() {
cout << "Matrix (" << rows << "x" << cols << "):\n";
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j)
cout << mat[i][j] << " ";
cout << endl;
}
} Page-3
Matrix add(Matrix b) {
Matrix result;
if (rows != b.rows || cols != b.cols) {
cout << "Addition not possible: Dimension mismatch!\n";
result.rows = result.cols = 0;
return result;
}
result.rows = rows;
result.cols = cols;
for (int i = 0; i < rows; ++i)
for (int j = 0; j < cols; ++j)
result.mat[i][j] = mat[i][j] + b.mat[i][j];
return result;
}
Matrix subtract(Matrix b) {
Matrix result;
if (rows != b.rows || cols != b.cols) {
cout << "Subtraction not possible: Dimension mismatch!\n";
result.rows = result.cols = 0;
return result;
}
result.rows = rows;
result.cols = cols;
for (int i = 0; i < rows; ++i) Page-4
for (int j = 0; j < cols; ++j)
result.mat[i][j] = mat[i][j] - b.mat[i][j];
return result;
}
Matrix multiply(Matrix b) {
Matrix result;
if (cols != b.rows) {
cout << "Multiplication not possible: Columns of A != Rows of B!\n";
result.rows = result.cols = 0;
return result;
}
result.rows = rows;
result.cols = b.cols;
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < b.cols; ++j) {
result.mat[i][j] = 0;
for (int k = 0; k < cols; ++k)
result.mat[i][j] += mat[i][k] * b.mat[k][j];
}
}
return result;
}
};
int main() {
Matrix A, B, Result; Page-5
int choice;
cout << "Enter rows and columns of Matrix A: ";
cin >> A.rows >> A.cols;
A.input();
cout << "Enter rows and columns of Matrix B: ";
cin >> B.rows >> B.cols;
B.input();
do {
cout << "\n--- Matrix Calculator ---\n";
cout << "1. Add Matrices\n";
cout << "2. Subtract Matrices\n";
cout << "3. Multiply Matrices\n";
cout << "4. Exit\n";
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1:
Result = A.add(B);
if (Result.rows && Result.cols)
Result.display();
break;
case 2:
Result = A.subtract(B);
if (Result.rows && Result.cols) Page-6
Result.display();
break;
case 3:
Result = A.multiply(B);
if (Result.rows && Result.cols)
Result.display();
break;
case 4:
cout << "Exiting...\n";
break;
default:
cout << "Invalid choice!\n";
}
} while (choice != 4);
return 0;
}
Page- 7
USER MANUAL
THIS IS A MENU BASED PROJECT WHICH PERFORMS A NUMBER OF TASK
WHICH IS USED FOR MATRIX CALCULATION. INPUT OF TWO MATRICES
AND THEIR ORDERS ARE REQUIRED TO BE INPUT BY THE USER.
BY RUNNING, THE USER IS PRESENTED WITH A MENU CONTAINING A
NUMBER OF OPERATORS TO DEAL WITH WHICH ARE AS FOLLOWS:
1.ADDITION
2.SUBSTRACTION
3.MULTIPLICATION
4.EXIT
Page- 8
Page-9
BIBLIOGRAPHY
1.OBJECT ORIENTED PROGRAMMING WITH C++
AUTHOR - E. BALAGURUSWAMI
2.A FIRST COURSE IN PROGRAMMING WITH C
AUTHOR - T. JEYAPOOVAN
3.COMPUTER SCIENCE AND APPLICATION
(A TEXTBOOK FOR CLASS-XII)
AUTHOR - MRS. SUMITA ARORA
S
Page- 10