#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
void main()
{
float bil[10][10], mak[10], min[10];
int brs, klm;
int j=0;
randomize();
cout<<"Banyaknya Baris : ";
cin>>brs;
cout<<"Banyaknya Kolom : ";
cin>>klm;
cout<<endl;
for(int i=0; i<brs; i++)
for(int j=0; j<klm; j++)
{
bil[i][j]=random(10);
}
for(int i=0; i<brs; i++)
{
for(int j=0; j<klm; j++)
{
cout<<bil[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
for(int i=0; i<brs; i++)
{
min[i]=bil[i][j];
mak[i]=bil[i][j];
for(int j=0; j<klm; j++)
{
if(mak[i]<bil[i][j])
{
mak[i]=bil[i][j];
}
if(min[i]>bil[i][j])
{
min[i]=bil[i][j];
}
}
}
for(int i=0; i<brs; i++)
{
cout<<"Baris ke-"<<(i+1)<<endl<<endl;
cout<<"Maksimal : "<<mak[i]<<endl;
cout<<"Minimal : "<<min[i]<<endl<<endl;
}
cout <<endl;
getch();
}
No comments:
Post a Comment