Codingan Array 2 Dimensi pada C++

Assalamu’alaikum warahmatullahi wabarokatuh

Saatnya untuk array 2 dimensi. Cekidot

Array 2 Dimensi

#include
#include
using namespace std;
int main()
{
int matrix[3][3];
int i,j;
float rata2, jumlah;
cout<<"———————————————-"<<endl;
cout<<"***Program Menghitung Nilai Rata – rata***"<<endl;
cout<<"———————————————-"<<endl;
cout<<"—————Penjelasan Program————-"<<endl;
cout<<"Masukkan 5 buah angka dan anda akan mengetahui"<<endl;
cout<<"———————————————-"<<endl;
cout<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<"Masukkan Nilai Angka Pada Baris Ke "<<i<<" dan Kolom Ke "<<j<>matrix[i][j];
}
cout<<endl;
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
cout<<matrix[i][j]<<" ";
}
cout<<endl;
cout<<endl;
}
jumlah = 0;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
jumlah = jumlah + matrix[i][j];
}
rata2 = jumlah/9;
cout<<"——————–Hasil——————–"<<endl;
cout<<"Nilai Rata – rata adalah "<<rata2<<endl;
cout<<"———————————————"<<endl;

cout<<endl;
cout<<endl;
}
system("PAUSE");
return (0);
}

About chandechildz

I'm the simple man Always happy everday every time every well View all posts by chandechildz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: