Source Code C++ Tranpos Matriks


Di bawah ini adalah source code C++ untuk mencari tranpos dari sebuah matrik.

/* —copy here— */

#include<stdio.h>

void main()
{
int A[2][2],B[2][2],C[2][2],D[2][2],E[2][2];
int i,j;

// Matiks A
printf(“Masukan matriks A\n”);
for(i=0;i<2;i++)
{for(j=0;j<2;j++)
{printf(“input data matriks A[%i][%i]: “,i+1,j+1);
fflush(stdin);scanf(“%i”,&A[i][j]);
}
}
printf(“————————————————\n”);

//Traspos matriks
printf(“Maka Transpose Matriks\n”);
for(i=0;i<2;i++)
{for(j=0;j<2;j++)
printf(“%6i”,A[j][i]);printf(“\n”);
}
printf(“\n\n”);
printf(“————————————————\n”);

}

—Selamat Mencoba—

Iklan

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s