Top 10 Programming Language to learn in 2023

Are you a programming enthusiast looking to stay ahead of the curve in 2023? With the ever-evolving tech landscape, keeping up with the Best Programming Language to learn can be a daunting task. Fear not, as we have compiled a list of the top 10 Programming Languages that you should consider learning in 2023. Python: This versatile language continues to dominate in 2023, with its ease of use, readability, and a vast library of modules. JavaScript: As web development grows increasingly popular, JavaScript remains a crucial player, with its ability to create dynamic and interactive web pages. Java: This language has stood the test of time and remains a popular choice for enterprise software development. C++: A staple in the gaming and systems development industries, C++ offers exceptional performance and memory management. Swift: Apple's preferred language for iOS app development, Swift continues to grow in popularity with its simplicity and reliability. R: As data science and machin...

C++ Program To Multiply Matrices | C++ Programming

C++ Program To Multiply Matrices

#include<iostream>
using namespace std;
class Matrix
{
private:
int a[10][10];
public:
void read_matrix(int m, int n);
void display_matrix(int m, int n);
void multiply_matrix(int ,int, int,Matrix x, Matrix y);
};
void Matrix::read_matrix(int m,int n)
{
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>a[i][j];
}
}
}
void Matrix::display_matrix(int m,int n)
{
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cout<<a[i][j] <<"\t";
}
cout<<endl;
}
}
void Matrix::multiply_matrix(int r1,int c1, int c2, Matrix x, Matrix y)
{
 for(int i=0; i<r1; i++)
    {
  for(int j=0; j<c2; j++)
        {
         a[i][j]=0;
   for(int k=0;k<c1;k++)
         {
          a[i][j]+=x.a[i][k]*y.a[k][j];
 }
 }
 }
}
int main()
{
int r1,c1,r2,c2;
cout<<"Enter order of first matrix: "; cin>>r1>>c1;
cout<<"Enter order of seond matrix: "; cin>>r2>>c2;
Matrix mat1,mat2,mat3;
if(c1==r2)
{
cout<<"Enter elements of first matrix: \n";
mat1.read_matrix(r1,c1);
cout<<"Enter elements of second matrix: \n";
mat2.read_matrix(r2,c2);
cout<<"First Matrix:\n";
mat1.display_matrix(r1, c1);
cout<<"Second Matrix:\n";
mat2.display_matrix(r2 , c2);
//Multplying matrix
mat3.multiply_matrix(r1,c1,c2,mat1,mat2);
cout<<"Output matrix: \n";
mat3.display_matrix(r1,c2);
}
else
{
cout<<"MATRIX CAN'T BE MULTIPLIED !";
}
//mat3.display_matrix(r1,c2);
}

Output


Enter order of first matrix: 2
3
Enter order of seond matrix: 3
2
Enter elements of first matrix:
2
1
3
4
5
6
Enter elements of second matrix:
2
1
4
5
6
7
First Matrix:
2       1       3
4       5       6
Second Matrix:
2       1
4       5
6       7
Output matrix:
26      28
64      71

Comments

Popular posts from this blog

Array in C Programming | C Programming

C program to Find Cartesian Product of Two Sets | C programming

What is System? | SAD