Program Matriks Menggunakan C++
#include <iostream.h>#include <conio.h>
int main()
{
int A[3] [3];
cout << "Matriks A" << endl;
for ( int i = 0; i < 3; i++ )
for ( int j = 0; j < 3; j++ )
{
cout << "Elemen [" << i + 1 << ", " << j + 1 << "] ";
cin >> A[i] [j];
}
int B[3] [3];
cout << "Matriks B" << endl;
for ( int i = 0; i < 3; i++ )
for ( int j = 0; j < 3; j++ )
{
cout << "Elemen [" << i + 1 << ", " << j + 1 << "] ";
cin >> B[i] [j];
}
for ( int i = 0; i < 3; i++ )
{
for ( int j = 0; j < 3; j++ )
{
cout << A[i] [j];
}
cout << endl;
}
cout << endl;
for ( int i = 0; i < 3; i++ )
{
for ( int j = 0; j < 3; j++ )
{
cout << B[i] [j];
}
cout << endl;
}
cout << endl;
int kurang[3] [3];
cout << "Pengurangan Matriks" << endl;
for ( int i = 0; i < 3; i++ )
{
for ( int j = 0; j < 3; j++ )
{
kurang[i] [j] = A[i] [j] - B[i] [j];
cout << kurang[i] [j] << " ";
}
cout << endl;
}
getch();
}
Langganan:
Posting Komentar
(
Atom
)
Tidak ada komentar :
Posting Komentar