The set described as a group that has many members who have been determined.Whereas a join is a multiplication between two sets. The following source code more :
#include <cstdlib>
#include <iostream>
using namespace std;
class matriks{
public:
matriks();
void input();
void cek();
void beri_nilai();
public:
int a[50][50],kolom, baris, hasil;
};
matriks::matriks(){
cout<<"Program Pengecekan Matrik"<<endl<<endl;
}
void matriks::input(){
ihir:
cout<<"Baris :";
cin>>baris;
cout<<endl;
cout<<"Kolom :";
cin>>kolom;
cout<<endl;
if (baris!=kolom) {
cout<<"Maaf, jumlah baris dan kolom harus sama\n\n";
goto ihir;
}
else{
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout <<"Data["<<i<<","<<j<<"] : ";
cin>>a[i][j];}
}
}
cout<<"\nMatriks : "<<endl;
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout<<" "<<a[i][j]<<" ";
}
cout <<endl;
}
}
void matriks:: cek(){
cout<<"\nSimetris? (True or False) :";
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
if(i==j && j==i)j++;
else{
if(a[i][j]!=a[j][i]){
cout<<"FALSE\n\n";
i=baris;
}
else hasil=1;
}
}
}
if (hasil==1) cout<<"true"<<endl;
}
int main(int argc, char *argv[])
{
matriks a;
a.input();
a.cek();
cout<<endl<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Running Result :
#include <cstdlib>
#include <iostream>
using namespace std;
class matriks{
public:
matriks();
void input();
void cek();
void beri_nilai();
public:
int a[50][50],kolom, baris, hasil;
};
matriks::matriks(){
cout<<"Program Pengecekan Matrik"<<endl<<endl;
}
void matriks::input(){
ihir:
cout<<"Baris :";
cin>>baris;
cout<<endl;
cout<<"Kolom :";
cin>>kolom;
cout<<endl;
if (baris!=kolom) {
cout<<"Maaf, jumlah baris dan kolom harus sama\n\n";
goto ihir;
}
else{
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout <<"Data["<<i<<","<<j<<"] : ";
cin>>a[i][j];}
}
}
cout<<"\nMatriks : "<<endl;
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
cout<<" "<<a[i][j]<<" ";
}
cout <<endl;
}
}
void matriks:: cek(){
cout<<"\nSimetris? (True or False) :";
for(int i=0;i<baris;i++){
for(int j=0;j<kolom;j++){
if(i==j && j==i)j++;
else{
if(a[i][j]!=a[j][i]){
cout<<"FALSE\n\n";
i=baris;
}
else hasil=1;
}
}
}
if (hasil==1) cout<<"true"<<endl;
}
int main(int argc, char *argv[])
{
matriks a;
a.input();
a.cek();
cout<<endl<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Running Result :