Ini adalah program untuk mengecek matriks diagonal
#include <cstdlib>
#include <iostream>
using namespace std;
/* run this program using the console pauser add your own getch, system ("pause") or input loop*/
int main(int argc, char *argv[])
{
system ("title================ Annisa Della ================");
int i, j;
int Matriks[100][100];
cout<<"\n\t"<<char(5)<<" Program Cek Matrik Diagonal 3x3 "<<char(5)<<endl<<endl;
cout<<"Matrik ordo 3x3\n"<<endl;
cout<<"0 0 0"<<endl;
cout<<"0 0 0 "<<endl;
cout<<"0 0 0"<<endl<<endl;
cout<<"Input Matriks :\n";
for(i=1; i<=3; i++){
for(j=1; j<=3; j++){
cout<<"Baris "<<i<<", Kolom "<<j<<" : ";
cin>>Matriks[i][j];
}}
cout<<endl;
cout<<"Hasil : \n"<<endl;
for(i=1; i<=3; i++){
for(j=1; j<=3; j++){
cout<<Matriks[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
if(Matriks[i=0][j=0] == 1){
if(Matriks[i=0][j=0] == 1){
if(Matriks[i=0][j=0] == 1){
cout<<"==> Keterangan : Bukan Matriks Diagonal!!! "<<char(1)<<endl;
}}}
else{cout<<"==> Keterangan : Matriks Diagonal..."<<endl;}
cout<<endl;
system("pause");
return 0;
}