Rref Bscs-Section 60
Rref Bscs-Section 60
#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
class matrixOperation
{
private:
void read()
{
cout << "\n\nEnter the number of Rows and Columns of matrix : ";
cin >> row >> col;
cout << "\nEnter the " << row * col << " elements of first matrix : \n";
cout << "\nEnter the " << row * col << " elements of second matrix : \n";
void show()
{
cout << "\n\nThe Answer matrix is : \n";
void add()
{
cout<<"\t\tYou Choose Matrix Addition\t\t";
read();
void subract()
{
cout<<"\t\tYou Choose Matrix Subtraction\t\t";
read();
show();
}
void echelon()
{
cout<<"Enter the number of rows and column: ";
cin>>row>>col;
int lead = 0;
lead++;
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
cout << setw(7) << setprecision(4) << A[i][j] << " ";
cout<<"\n";
}
cout<<"\n";
}
}
public:
void option()
{
cout<<"\t\tChoice a Matrix Operation\t\t\n\n";
cout<<"[1]-Matrix addition: \n" ;
cout<<"[2]-Matrix Subtraction: \n";
cout<<"[3]-Row Reduced Echelon Form: \n";
switch(operation)
{
case 1:
add();
break;
case 2:
subract();
break;
case 3:
echelon();
break;
default:
cout << "Error! The operation is not correct";
break;
}
}
};
int main()
{
matrixOperation operation;
operation.option();
return 0;
}