Friday, 1 June 2012

Program Matrik Generate Raptor

#include <iostream>
#include <string>

using namespace std;
void matrik (int i, int s)

{
string raptor_prompt_variable_zzyz;
int j;
int k;
int baris;
int kolom;
int matrik1[100];
int matrik2[100];
int mat_kali[100];
int jumlah[100];

if (s==1)
{
raptor_prompt_variable_zzyz ="masukan baris : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> baris;
raptor_prompt_variable_zzyz ="masukan kolom : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> kolom;
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
raptor_prompt_variable_zzyz ="isi matrik : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> matrik1[i,j];
j =j+1;
}
i =i+1;
}
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
raptor_prompt_variable_zzyz ="isi matrik : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> matrik2[i,j];
j =j+1;
}
i =i+1;
}
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
jumlah[i,j] = matrik1[i,j]+matrik2[i,j];
j =j+1;
}
i =i+1;
}
cout << "matrik input : "+baris << endl; i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
cout << jumlah[i,j] << endl; j =j+1;
}
i =i+1;
}
}
else
{
raptor_prompt_variable_zzyz ="masukan baris : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> baris;
raptor_prompt_variable_zzyz ="masukan kolom : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> kolom;
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
raptor_prompt_variable_zzyz ="isi matrik : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> matrik1[i,j];
j =j+1;
}
i =i+1;
}
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
raptor_prompt_variable_zzyz ="isi matrik : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> matrik2[i,j];
j =j+1;
}
i =i+1;
}
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
if (baris==kolom)
{
mat_kali[i,j] = 0;
k =1;
while (!(k>baris))
{
mat_kali[i,j] = mat_kali[i,j]+matrik1[i,k]*matrik2[k,j];
k =k+1;
}
}
else
{
cout << "tidak bisa dikali" << endl; }
j =j+1;
}
i =i+1;
}
i =1;
while (!(i>baris))
{
j =1;
while (!(j>kolom))
{
cout << mat_kali[i,j] << endl; j =j+1;
}
i =i+1;
}
}
}
int main()
{
string raptor_prompt_variable_zzyz;
int s;
int i;

raptor_prompt_variable_zzyz ="pilih 1 pejumlahan dan 2 perkalian matrik: ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> s;
i =1;
matrik(i,s);

system("PAUSE");
return 0;
}

0 comments:

Post a Comment

.

.

.

.
Design by BlogSpotDesign | Ngetik Dot Com