Thursday, 23 November 2017

C++ Program to Find Transpose of a Graph Matrix


Code:

#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<
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= n; j++)
        {
            cout<
        }
        cout<
    }
    cout<
    for (i = 1; i <= n; i++)
    {
        for (j = 1; j <= n; j++)
        {
            cout<
        }
        cout<
    }
    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


More C++ Programs:

















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...