Skip to content Skip to sidebar Skip to footer
Welcome to danskuyy.com

MEMBUAT ARRAY BILANGAN MATRIKS

Berikut ini adalah cara membuat Array bilangan matriks, silahkan anda praktekan ya.

#include<iostream>
using namespace std;
main()
{
cout<<"\n\tMFY\n\n=======================================\n";
int matrix[2][3]={{1,2,3},{4,5,6}};
char mat[2][4]={{'A','B','C','D'},{'E','F','G','H'}};
for(int i=0;i<2;i++)
{
for(int j=0;j<3;j++)
{
cout<<matrix[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
for(int n=0;n<2;n++)
{
for(int m=0;m<4;m++)
{
cout<<mat[n][m]<<" ";
}
cout<<endl;
}
return 0;
}


Jika anda berhasil maka hasil outputnya seperti gambar dibawah ini.




Post a Comment for "MEMBUAT ARRAY BILANGAN MATRIKS"