#include <cstdlib>
#include <iostream>
using namespace std;
int data[2][2];
void baca (int [][2]){
for(int i=1;i<=2;i++)
for(int j=1;j<=2;j++){
cout<<"Masukkan "<<i<<","<<j<<" : ";
cin>>data[i][j];}
}
void tulis (const int [][2]){
for(int i=1;i<=2;i++){
for(int j=1;j<=2;j++)
cout<<" "<<data[i][j];
cout<<endl;}
}
void hitung (const int [][2]){
cout<<((data[1][1]*data[2][2])-(data[1][2]*data[2][1]))<<endl; }
int main(){
cout<<"Masukkan data Matrik : \n";
baca(data);
cout<<"\nCetak data Matrik :\n";
tulis(data);
cout<<"\nHasil determinan : \n";
hitung(data);
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
int data[2][2];
void baca (int [][2]){
for(int i=1;i<=2;i++)
for(int j=1;j<=2;j++){
cout<<"Masukkan "<<i<<","<<j<<" : ";
cin>>data[i][j];}
}
void tulis (const int [][2]){
for(int i=1;i<=2;i++){
for(int j=1;j<=2;j++)
cout<<" "<<data[i][j];
cout<<endl;}
}
void hitung (const int [][2]){
cout<<((data[1][1]*data[2][2])-(data[1][2]*data[2][1]))<<endl; }
int main(){
cout<<"Masukkan data Matrik : \n";
baca(data);
cout<<"\nCetak data Matrik :\n";
tulis(data);
cout<<"\nHasil determinan : \n";
hitung(data);
system("PAUSE");
return EXIT_SUCCESS;
}
.
Tidak ada komentar:
Posting Komentar