VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
CS201 (PRACTICAL) ASSIGNMENT 2 SOLUTION SPRING 2022
Provide by VU Answer
Due Date: 18 Aug 2022
Total Marks: 20
Must Follow these Important Instruction:
Submit your solution file only in .CPP Format
The FIRST digit of your VU id.
Like BC200803333, here 2 is the first digit need to be passed in this function.
Download Ready .CPP File from VUAnswer.com
Join Our WhatsApp Group for VU Solutions or Updates
https://chat.whatsapp.com/HGu2lvOWPsi0tpPGc4IGDZ
CODE Solution:
#include<iostream>
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
#define ROW 3
#define COL 3
using namespace std;
class AddMatrix{
private:
int matrix[ROW][COL];
public:
AddMatrix(){
for(int i=0;i<ROW;i++){
for(int j=0;j<COL;j++){
matrix[i][j] = 0;
}
}
}
AddMatrix(int array[]){
setMatrix(array);
}
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
void setMatrix(int array[]){
for(int i=0;i<ROW;i++){
for(int j=0;j<COL;j++){
matrix[i][j] = array[COL *i + j];
}
}
}
AddMatrix operator + (AddMatrix &x){
AddMatrix y;
for(int i=0;i<ROW;i++){
for(int j=0;j<COL;j++){
y.matrix[i][j] = matrix[i][j] + x.matrix[i][j];
}
}
return y;
}
friend AddMatrix Multiply(AddMatrix &x, int id){
AddMatrix y;
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
for(int i=0;i<ROW;i++){
for(int j=0;j<COL;j++){
y.matrix[i][j] = id * x.matrix[i][j];
}
}
return y;
}
void display(AddMatrix &result){
for(int i=0;i<ROW;i++){
for(int j=0;j<COL;j++){
cout<<result.matrix[i][j]<<"\t";
}
cout<<endl;
}
}
};
int main(){
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
int array[] = {0,1,2,3,0,3,1,2,0};
AddMatrix matrix(array), multiplied, sum;
multiplied = Multiply(matrix, 2);
sum = multiplied + matrix;
cout<<"Matrix:"<<endl;
matrix.display(matrix);
cout<<"Multiplied with first digit 2:"<<endl; // First Digit of Our VU ID
multiplied.display(multiplied);
cout<<"sum:"<<endl;
sum.display(sum);
return 0;
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
CODE OUTPUT
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
REGARD SARIM
WHATSAPP +923162965677
PLEASE NOTE:
Don't copy-paste the same answer.
Make sure you can make some changes to your solution file
before submitting copy paste solution will be marked zero.
If you found any mistake then correct yourself and inform me.
Before submitting an assignment must check your assignment
requirement file.
If you need some help or question about file and solutions feel
free to ask.
FREE TO GET MORE ASSIGNMENTS SOLUTION VISIT
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc
VISIT ANY MORE FREELY SOLUTIONS
VUAnswer.com
VUAnswer.com
JOIN WHATSAPP GROUP
https://chat.whatsapp.com/J1JTGFr367171U0YtH82Mc