//Tugas : Prak. Algotritma & Struktur Data II
//Nama : I WAYAN SUDARYA
//Nim : 100010783
//Kls : V101
//Determinan Matriks
#include <iostream.h>
#include <conio.h>
#define Nmaks 4
void main()
{
typedef matriks[Nmaks][Nmaks];
int i,j,determinan;
matriks A;
char answer;
do
{
clrscr();
cout<<"DETERMINAN MATRIKS A : "<<endl<<endl;
cout<<"Masukkan Nilai Matriks A : "<<endl;
for(i=1;i<=3;i++)
{
for(j=1;j<=3;j++)
{
cout<<"A["<<i<<","<<j<<"] = ";
cin>>A[i][j];
}
}
clrscr();
cout<<endl;
//Proses Mencari Determinan Matriks A
determinan = ((A[1][1]*A[2][2]*A[3][3])+(A[1][2]*A[2][3]*A[3][1])+(A[1][3]*A[2][1]*A[3][2])) -
((A[3][1]*A[2][2]*A[1][3])+(A[3][2]*A[2][3]*A[1][1])+(A[3][3]*A[2][1]*A[1][2]));
clrscr();
//Output Matriks A
gotoxy(1,5);
cout<<"A = ";
for(i=1;i<=3;i++)
{
for(j=1;j<=3;j++)
{
gotoxy(2+4*j,2+2*i);
cout<<A[i][j];
}
}
gotoxy(1,12);
cout<<"Determinan Matriks A = "<<determinan;
cout<<endl;
getch();
clrscr();
cout<<"== PROGRAM SELESAI =="<<endl<<endl;
cout<<"Mau Melakukan Perhitungan Lagi?? [Y/T] "; cin>>answer;
}
while ((answer == 'y') || (answer == 'Y'));
}
Jumat, 08 Juli 2011
Determinan Matriks
Wayan Sudarya
No comments
0 komentar:
Posting Komentar