Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

C++ IMAGE COMPRESSION CODE.docx

Rating
-
Sold
-
Pages
19
Grade
A
Uploaded on
18-01-2026
Written in
2024/2025

Inventory Tracking Module (Matrix Addition) CODE, Student Grades Organization (Transpose) CODE, Image Compression (Linearization) CODE, Professional Event Management - Seating Arrangement CODE, Tic-Tac-Toe CODE

Institution
Course

Content preview

CP LAB ASSIGNMENT

BSIT SEMESTER #01

UROOJ ASGHAR KHAN

02-135242-006




Task 1: Inventory Tracking Module (Matrix Addition)
Suppose you are managing a warehouse where you need to track inventory levels of
different products across multiple locations. Each location has its own inventory count
for various products, and you want to consolidate this information to get an overall
view of inventory levels.
 Matrix A represents the inventory levels of various products across different
locations for the current month.
 Matrix B represents the inventory levels of the same products across the same
locations for the previous month.
Write a C++ program that takes input for matrices A and B, performs matrix addition,
and outputs the consolidated inventory levels for each product across different
locations.



CODE:
#include <iostream>

#include <vector>

using namespace std;

const int ROWS = 3;

const int COLS = 4;

void inputMatrix(int matrix[ROWS][COLS], const string& matrixName) {

cout << "Enter inventory levels for " << matrixName << " (Matrix " << matrixName << "):"
<< endl;

for (int i = 0; i < ROWS; i++) {

for (int j = 0; j < COLS; j++) {

cout << "Location " << i + 1 << ", Product " << j + 1 << ": ";

cin >> matrix[i][j];

}

}

}

,CP LAB ASSIGNMENT

BSIT SEMESTER #01

UROOJ ASGHAR KHAN

02-135242-006

void addMatrices(int matrixA[ROWS][COLS], int matrixB[ROWS][COLS], int result[ROWS]
[COLS]) {

for (int i = 0; i < ROWS; i++) {

for (int j = 0; j < COLS; j++) {

result[i][j] = matrixA[i][j] + matrixB[i][j];

}

}

}

void displayMatrix(int matrix[ROWS][COLS], const string& matrixName) {

cout << "\n" << matrixName << " (Consolidated Inventory Levels):\n";

for (int i = 0; i < ROWS; i++) {

for (int j = 0; j < COLS; j++) {

cout << matrix[i][j] << " ";

}

cout << endl;

}

}

int main() {

int matrixA[ROWS][COLS];

int matrixB[ROWS][COLS];

int result[ROWS][COLS];

inputMatrix(matrixA, "Current Month");

inputMatrix(matrixB, "Previous Month");

addMatrices(matrixA, matrixB, result);

displayMatrix(result, "Consolidated Inventory Levels");



return 0;

}

, CP LAB ASSIGNMENT

BSIT SEMESTER #01

UROOJ ASGHAR KHAN

02-135242-006

OUTPUT:




Task 2: Students Grades Organization (Transpose)
You have a matrix where each row represents a student and each column represents
an assignment. However, your grading system is set up in such a way that rows
represent assignments, and columns represent students. To analyze the grades more
effectively, you need to transpose the matrix so that each row represents an
assignment and each column represents a student.
Write a C++ program that takes input for the original matrix representing student
grades, calculates its transpose, and outputs the transposed matrix where rows
represent assignments and columns represent students. Additionally, provide average
grades for each assignment.



CODE:
#include <iostream>
#include <vector>
#include <iomanip>

Written for

Course

Document information

Uploaded on
January 18, 2026
Number of pages
19
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$8.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
uroojkhan1

Also available in package deal

Get to know the seller

Seller avatar
uroojkhan1 Bahria university
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 months
Number of followers
0
Documents
13
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions