Lecture 46
Array
Code:
//Array
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
int
num1[4]={2,3,4,5}; //declaration &
Initialization
int
num2[]={2,3,4,5}; //declaration &
Initialization
cout<<num1[0]<<" * "<<num2[0]<<"
= "<<num1[0]*num2[0]<<endl;
cout<<num1[1]<<" * "<<num2[1]<<"
= "<<num1[1]*num2[1]<<endl;
cout<<num1[2]<<" * "<<num2[2]<<"
= "<<num1[2]*num2[2]<<endl;
cout<<num1[3]<<" * "<<num2[3]<<"
= "<<num1[3]*num2[3]<<endl;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10