PENAMBAHAN MATRIKS

Matriks yang dijumlahkan harus memiliki orde yang sama.

contoh :

#include <iostream>
using namespace std;
int main()
{
int x[1][1];
int y[1][1];
int z[1][1];
x[0][0]=1;
x[1][0]=2;
x[0][1]=3;
x[1][1]=4;
y[0][0]=3;
y[1][0]=7;
y[0][1]=4;
y[1][1]=8;
for (int i=0;i<2;i++){
for (int j=0;j<2;j++){
z[i][j]=x[i][j]+y[i][j];
cout << z[i][j]<<endl;}}
return 0;
}

jjjjj1

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s


%d bloggers like this: