Selasa, 17 Mei 2011

Matrix search programs and relations


Program to read a member of two sets m and n then processed m x n, as we all know that:
1.     1.    Matrix
Is a scalar matrix is a composition of elements in the form of rows and columns.
A matrix size of m rows and n columns (m ´ n) is:
                             
            Symmetry matrix is the matrix that aij = aji for all i and j.
            Below is an example of matrix symmetry.
                                       
           Matrix of zero-one (0 / 1) is a matrix which each element is 0 or 1 only.
2.   Relation
Binary relation R between sets A and B is a subset of A ´ B
Notation: R Í (A ´ B).

Algoritmah:
Algorithm to find the value of the matrix and the relation of input.
{algorithm search, enter the input, process, search results (output)}


Declaration:
                    i, j [50]: integer
                   a, b, c, d: integer

Description:
                    for (a = 0; a <c;a++) cin>> i [a];

                  
  for (b = 0; b <d;b++) cin>> j [b];

                     
        court <<i [a ]<<","<< j [b] <<endl;

                 
     endfor

#include<iostream>
#include<conio.h>
int main ()
{
int i[50], j[50];
int a,b,c,d;
cout<<"masukkan data="; cin>>c;
for (a=0;a<c;a++)
{
cin>>i[a];}
cout<<"masukkan data=";cin>>d;
for (b=0;b<d;b++)
{
cin>>j[b];}
for (a=0;a<c;a++)
{
for (b=0;b<d;b++)
{
cout<<i[a]<<","<< j[b]<<endl;}
}
return 0;
}

Tidak ada komentar:

Posting Komentar