# How to design a matrix calculator in c++

## Objective:

Design a **matrix calculator** in c++ . To make the solving problem about the simple matrix easy with the help of C++ program. Each step is explained below.

## Abstract:

In this project of matrix calculator we had written a program in C++ with the help of two dimensional arrays and for loop and if statement in which when user enter a matrix of order 2by2 the program give transpose, determinant, adjoints and if possible the inverse of that matrix as an output.

### Steps to code program:

This program is simple however below I have explain how it is written

• First of all we include two header files which are always ncluded in every programes means iostream.h and conio.h and after it we write void main .

• Now we start basic coding of program .Here first introduces matrix and transpose arrays and row, column, i and j for a for loop as variable datatype.

• Here we insert the determinant and adjoint variable in float and inverse variable in double data type.

• Then we ask the user to entererd the matrix elements.

• Now we declare transpose ,determinant , adjoint and inverse definition.

• Here we ask the program to display output on screen.

• Now user gets the result from the screen.

### Flow chart

#### Code of designing a matrix calculator in C++

#include<iostream.h> #include<conio.h>

Void main()

{Clrscr();

Into m[10][10],r,c,trans[10][10],t[10][10],I,j; Float adj[10][10],det; double inv[10][10;

Court<<”enter the rows”;

Cin>>r;

Court<<”enter column”;

Cin>>c;

Court<<”enter matrix “;

For(I=0;I<r;I++)

For(j=0;j<c;j++)

{cin>>m[I][j];}

Court<<”transpose “:

For(I=0;I<r;I++)

For(j=0;j<c;j++)

{trans[j][I]=m[I][j];}

For(I=0;I<c;I++)

For(j=0;j<r;j++)

{court<<trans[I][j];} det=m[0][0]*m[1][1]-m[1][0]*m[0][1]; court<<”determinent”<<det; court<<”adjoint”:

t[0][0]=m[1][1]; t[0][1]=-m[1][0]; t[1][0]=-m[0][1]; t[1][1]=m[0][0]; adj[0][0]=t[0][0]; adj[1][0]=t[0][1]; adj[0][1]=t[1][0];

adj[1][1]=t[1][1]; court<<adj[0][0]<<adj[0][1] court<<adj[1][0]<<adj[1][1]; court”inverse”; inv[0][0]=adj[0][0]/det; inv[0][1]=adj[0][1]/det; inv[1][0]=adj[1][0]/det; inv[1][1]=adj[1][1]/det;

Court<<inv[0][0]<<inv[0][1]

Court<<inv[1][0]<<inv[1][1];

Fetch()

}

Also read here more projects

https://eevibes.com/computing/object-oriented-programming/design-a-project-of-vehicle-parking-in-c/