Rabu, 26 September 2012

Program array

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{  
    int matrix[2][2];
    int i,j;

    for(i=0;i<=1;i++){
                      for(j=0;j<=2;j++){
cout<<"Masukkan Nilai  "<<i<<" Ke Kolom  "<<j<<" : ";
                cin>>matrix[i][j];
                }
cout<<endl;
           }
           for(i=0;i<=1;i++){
           for(j=0;j<=2;j++){
                      cout<<matrix[i][j]<<" ";
                                               }
                             cout<<endl;
                             }
cout<<"****************************************************** \n ";

 int mat[2][2];
    for(i=0;i<=1;i++){
                      for(j=0;j<=2;j++){
cout<<"Masukkan Nilai "<<i<<" Ke Kolom "<<j<<" : ";
                cin>>mat[i][j];
                }
cout<<endl;
           }          
           for(i=0;i<=1;i++){
           for(j=0;j<=1;j++){
                      cout<<mat[i][j]<<" ";
                                               }
                             cout<<endl;
                             }
cout<<"*********************"<<endl;
int jumlah[i][j];{
    for(i=0;i<=1;i++){
                      cout<<endl;
           for(j=0;j<=2;j++){
jumlah[i][j]=matrix[i][j] + mat [i][j];
    cout<<"  "<<jumlah[i][j];
   
}
}
}
    system("PAUSE");
    return EXIT_SUCCESS;
}

Tidak ada komentar:

Posting Komentar