Of course during junior high, high school friends had already learned about the matrix's, and of course friends, the park must have known what it is symmetric. At this time I will mengimplemntasikannya into C++ programming. Now friends can see the algorithms and programs. Check it out ...!
Algoritma :
Deklarasi
a : integer of array
n : integer
Deskripsi
read(n)
for x <= 0 to n do
for y <= 0 to n do
a[x][y]
endfor
endfor
for x <= 0 to n do
for y <= 0 to n do
a[x][y]
endfor
endfor
for x <= 0 to n do
for y <= 0 to n do
if(a[x][y]==a[y][x]) then
write(Simetris)
else
write(Tidak Simetris)
endif
endfor
enfor
Berikut kode programnya :
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a[10][10];
int n;
cout<<"Masukan Jumlah matriks:";
cin>>n;
for(int x=0;x<n;x++)
for(int y=0;y<n;y++)
{
cout<<"Data["<<x+1<<"]:";
cin>>a[x][y];
}
for(int x=0;x<n;x++)
{
for(int y=0;y<n;y++)
{
cout<<" "<<a[x][y];
}
cout<<endl;
}
for(int x=0;x<n;x++)
for(int y=0;y<n;y++)
{
if(a[x][y]==a[y][x])
{
cout<<"Simetris"<<endl;
}
else
{
cout<<"Tidak Simetris"<<endl;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
explanation:
The above program is a program to determine the symmetrical or not a matrix. Said to be symmetric if a [x] [y] = a [y] [x] but otherwise it is not symmetrical. In this program, using the election if the conditions had been determined earlier. Users simply enter a value or element of the matrix.
The above program is a program to determine the symmetrical or not a matrix. Said to be symmetric if a [x] [y] = a [y] [x] but otherwise it is not symmetrical. In this program, using the election if the conditions had been determined earlier. Users simply enter a value or element of the matrix.
0 komentar:
Posting Komentar