Lecture 52
Array
// Double Dimensional Array
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
int
arr[2][2]={12,23,2,24};
int
arr1[][2]={14,26,27,29};
int arr2[][2]={0};
cout<<"1
Array \n\n";
cout<<arr[0][0]<<" "<<arr[0][1]<<"\n"
<<arr[1][0]<<" "<<arr[1][1];
cout<<"\n\n2 Array \n\n";
cout<<arr1[0][0]<<"
"<<arr1[0][1]<<"\n"
<<arr1[1][0]<<" "<<arr1[1][1];
arr2[0][0]=arr[0][0]*arr1[0][0];
arr2[0][1]=arr[0][1]*arr1[0][1];
arr2[1][0]=arr[1][0]*arr1[1][0];
arr2[1][1]=arr[1][1]*arr1[1][1];
cout<<"\n\nResult\n";
cout<<endl<<arr2[0][0]<<"
"<<arr2[0][1]<<"\n"
<<arr2[1][0]<<" "<<arr2[1][1];
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10