test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
37
.config/Code/User/History/21fc77b3/00hf.cpp
Normal file
37
.config/Code/User/History/21fc77b3/00hf.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
42
.config/Code/User/History/21fc77b3/07EM.cpp
Normal file
42
.config/Code/User/History/21fc77b3/07EM.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
23
.config/Code/User/History/21fc77b3/2mzD.cpp
Normal file
23
.config/Code/User/History/21fc77b3/2mzD.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
26
.config/Code/User/History/21fc77b3/3MjE.cpp
Normal file
26
.config/Code/User/History/21fc77b3/3MjE.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
52
.config/Code/User/History/21fc77b3/6jvQ.cpp
Normal file
52
.config/Code/User/History/21fc77b3/6jvQ.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols, "multiplied");
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
28
.config/Code/User/History/21fc77b3/6lVf.cpp
Normal file
28
.config/Code/User/History/21fc77b3/6lVf.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=rows;i<max;i++){
|
||||
matrix[i] = new int[cols];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
51
.config/Code/User/History/21fc77b3/6uwT.cpp
Normal file
51
.config/Code/User/History/21fc77b3/6uwT.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix(3, 3);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
81
.config/Code/User/History/21fc77b3/96Mj.cpp
Normal file
81
.config/Code/User/History/21fc77b3/96Mj.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
Matrix(const Matrix& m) : rows(m.rows), cols(m.cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i = 0; i < rows; ++i){
|
||||
matrix[i] = new int[cols];
|
||||
for(int j = 0; j < cols; ++j){
|
||||
matrix[i][j] = m.matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
~Matrix(){
|
||||
for(int i=0;i<rows;i++){
|
||||
delete[] matrix[i];
|
||||
}
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
79
.config/Code/User/History/21fc77b3/9I82.cpp
Normal file
79
.config/Code/User/History/21fc77b3/9I82.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
Matrix(const Matrix& m) : rows(m.rows), cols(m.cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0; i<rows;i++){
|
||||
matrix[i] = new int[cols];
|
||||
for(int j=0;j<cols;j++){
|
||||
matrix[i][j] = m.matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
~Matrix(){
|
||||
for(int i=0;i<rows;i++) delete[] matrix[i];
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
82
.config/Code/User/History/21fc77b3/EPAR.cpp
Normal file
82
.config/Code/User/History/21fc77b3/EPAR.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
Matrix(const Matrix& m) : rows(m.rows), cols(m.cols) {
|
||||
matrix = new int*[rows];
|
||||
for(int i = 0; i < rows; ++i) {
|
||||
matrix[i] = new int[cols];
|
||||
for(int j = 0; j < cols; ++j) {
|
||||
matrix[i][j] = m.matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
~Matrix(){
|
||||
for(int i=0;i<rows;i++){
|
||||
cout<<matrix[i]<<endl;
|
||||
delete[] matrix[i];
|
||||
}
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
26
.config/Code/User/History/21fc77b3/IjPz.cpp
Normal file
26
.config/Code/User/History/21fc77b3/IjPz.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
19
.config/Code/User/History/21fc77b3/InRu.cpp
Normal file
19
.config/Code/User/History/21fc77b3/InRu.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
64
.config/Code/User/History/21fc77b3/Ky42.cpp
Normal file
64
.config/Code/User/History/21fc77b3/Ky42.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 3);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
38
.config/Code/User/History/21fc77b3/MDaE.cpp
Normal file
38
.config/Code/User/History/21fc77b3/MDaE.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
52
.config/Code/User/History/21fc77b3/O8xi.cpp
Normal file
52
.config/Code/User/History/21fc77b3/O8xi.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
64
.config/Code/User/History/21fc77b3/T8N2.cpp
Normal file
64
.config/Code/User/History/21fc77b3/T8N2.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
17
.config/Code/User/History/21fc77b3/TRch.cpp
Normal file
17
.config/Code/User/History/21fc77b3/TRch.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
13
.config/Code/User/History/21fc77b3/VhFA.cpp
Normal file
13
.config/Code/User/History/21fc77b3/VhFA.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
69
.config/Code/User/History/21fc77b3/WYhC.cpp
Normal file
69
.config/Code/User/History/21fc77b3/WYhC.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
~Matrix(){
|
||||
for(int i=0;i<rows;i++) delete[] matrix[i];
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
33
.config/Code/User/History/21fc77b3/aKZa.cpp
Normal file
33
.config/Code/User/History/21fc77b3/aKZa.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
64
.config/Code/User/History/21fc77b3/bYrr.cpp
Normal file
64
.config/Code/User/History/21fc77b3/bYrr.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 3);
|
||||
Matrix m2(2, 3);
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
72
.config/Code/User/History/21fc77b3/cvTh.cpp
Normal file
72
.config/Code/User/History/21fc77b3/cvTh.cpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
~Matrix(){
|
||||
for(int i=0;i<rows;i++){
|
||||
cout<<matrix[i]<<endl;
|
||||
delete[] matrix[i];
|
||||
}
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
52
.config/Code/User/History/21fc77b3/eRsg.cpp
Normal file
52
.config/Code/User/History/21fc77b3/eRsg.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->row, m.col, "multiplied");
|
||||
for(int i=0;i<result.row;i++){
|
||||
for(int j=0;j<result.col;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->col;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
1
.config/Code/User/History/21fc77b3/entries.json
Normal file
1
.config/Code/User/History/21fc77b3/entries.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/lab11/q3.cpp","entries":[{"id":"VhFA.cpp","timestamp":1713153300076},{"id":"uxIA.cpp","timestamp":1713153363776},{"id":"TRch.cpp","timestamp":1713153407013},{"id":"eoYF.cpp","timestamp":1713153418737},{"id":"InRu.cpp","timestamp":1713153454237},{"id":"2mzD.cpp","timestamp":1713153570230},{"id":"IjPz.cpp","timestamp":1713153623720},{"id":"6lVf.cpp","timestamp":1713153641904},{"id":"3MjE.cpp","timestamp":1713153655547},{"id":"hjOW.cpp","timestamp":1713153812181},{"id":"aKZa.cpp","timestamp":1713153822425},{"id":"00hf.cpp","timestamp":1713154229096},{"id":"MDaE.cpp","timestamp":1713154239806},{"id":"07EM.cpp","timestamp":1713154518676},{"id":"eRsg.cpp","timestamp":1713154825243},{"id":"6jvQ.cpp","timestamp":1713154839430},{"id":"O8xi.cpp","timestamp":1713154856931},{"id":"6uwT.cpp","timestamp":1713154879952},{"id":"rdtq.cpp","timestamp":1713154930677},{"id":"bYrr.cpp","timestamp":1713154946941},{"id":"kK88.cpp","timestamp":1713154991600},{"id":"Ky42.cpp","timestamp":1713155055866},{"id":"T8N2.cpp","timestamp":1713155486055},{"id":"WYhC.cpp","timestamp":1713155655786},{"id":"cvTh.cpp","timestamp":1713155848381},{"id":"EPAR.cpp","timestamp":1713156188303},{"id":"96Mj.cpp","timestamp":1713156218832},{"id":"9I82.cpp","timestamp":1713156317449},{"id":"lKUn.cpp","timestamp":1713161237501}]}
|
19
.config/Code/User/History/21fc77b3/eoYF.cpp
Normal file
19
.config/Code/User/History/21fc77b3/eoYF.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
33
.config/Code/User/History/21fc77b3/hjOW.cpp
Normal file
33
.config/Code/User/History/21fc77b3/hjOW.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
63
.config/Code/User/History/21fc77b3/kK88.cpp
Normal file
63
.config/Code/User/History/21fc77b3/kK88.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 3);
|
||||
Matrix m2(2, 3);
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
79
.config/Code/User/History/21fc77b3/lKUn.cpp
Normal file
79
.config/Code/User/History/21fc77b3/lKUn.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
}
|
||||
|
||||
Matrix(const Matrix& m) : rows(m.rows), cols(m.cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0; i<rows;i++){
|
||||
matrix[i] = new int[cols];
|
||||
for(int j=0;j<cols;j++){
|
||||
matrix[i][j] = m.matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cout<<matrix[i][j]<<" ";
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
~Matrix(){
|
||||
for(int i=0;i<rows;i++) delete[] matrix[i];
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 2);
|
||||
m1.input();
|
||||
Matrix m2(2, 3);
|
||||
m2.input();
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
63
.config/Code/User/History/21fc77b3/rdtq.cpp
Normal file
63
.config/Code/User/History/21fc77b3/rdtq.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
int rows;
|
||||
int cols;
|
||||
int **matrix;
|
||||
public:
|
||||
|
||||
Matrix(int rows, int cols) : rows(rows), cols(cols){
|
||||
matrix = new int*[rows];
|
||||
for(int i=0;i<rows;i++) matrix[i] = new int[cols];
|
||||
input();
|
||||
}
|
||||
|
||||
void input(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(){
|
||||
cout<<"Enter values: ";
|
||||
for(int i=0;i<rows;i++){
|
||||
for(int j=0;j<cols;j++){
|
||||
cin>>matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Matrix operator*(Matrix m){
|
||||
Matrix result(this->rows, m.cols);
|
||||
for(int i=0;i<result.rows;i++){
|
||||
for(int j=0;j<result.cols;j++){
|
||||
int no = 0;
|
||||
for(int x=0;x<this->cols;x++){
|
||||
no += this->matrix[i][x]*m.matrix[x][j];
|
||||
}
|
||||
result.matrix[i][j] = no;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
Matrix m1(3, 3);
|
||||
Matrix m2(2, 3);
|
||||
|
||||
Matrix m3 = m1*m2;
|
||||
m3.print();
|
||||
|
||||
return 0;
|
||||
}
|
17
.config/Code/User/History/21fc77b3/uxIA.cpp
Normal file
17
.config/Code/User/History/21fc77b3/uxIA.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Matrix{
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue