This C++ program displays the transpose of a graph matrix
Here is the source code of the C++ program to display the augmented matrix along with the inverse of the matrix taken as input. This C++ program is successfully compiled and run on DevCpp, a C++ compiler. The program output is given below.
/*
* C++ Program to Find Transpose of a Graph Matrix
*/
#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
int main()
{
int i, j, n;
int a[10][10] = {0},b[10][10] = {0};
cout<<"Enter the order of matrix ";
cin>>n;
cout<<"Enter the elements\n";
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n; j++)
{
cin>>a[i][j];
}
}
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n; j++)
{
b[j][i] = a[i][j];
}
}
cout<<endl<<"Original Matrix\n";
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n; j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<endl<<"Transpose Matrix\n";
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n; j++)
{
cout<<b[i][j]<<" ";
}
cout<<endl;
}
getch();
}
Output Enter the order of matrix 3 Enter the elements 5 3 1 8 6 9 4 7 0 Original Matrix 5 3 1 8 6 9 4 7 0 Transpose Matrix 5 8 4 3 6 7 1 9 0
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
advertisement
advertisement
If you wish to look at all C++ Programming examples, go to C++ Programs.
Next Steps:
- Get Free Certificate of Merit in Data Structure I
- Participate in Data Structure I Certification Contest
- Become a Top Ranker in Data Structure I
- Take Data Structure I Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Related Posts:
- Buy Computer Science Books
- Buy Data Structure Books
- Practice Computer Science MCQs
- Practice Programming MCQs
- Apply for Computer Science Internship