Given the following array, add the each element corresponding to its position to form a new array in array1: (In-direct Addressing)
.data
array1 DWORD 0A1223D48h, 11DE33ABh, 11223344h
array2 WORD 0FFFFh, 0A123h, 556Ch
.code
#include<iostream.h>
#include<condo.h>
#include<iomanip.h>
void main()
{
int a[50],i,pos,ele,n;
clrscr();
cout<<"enter the no"<<endl;
cin>>n;
cout<<"enter the elements";
for(i=0;i<n;i++)
cin>>a[i];
cout<<"enter the search element";
cin>>ele;
pos=-1;
for(i=0;i<n;i++)
if(ele==a[i])
{
if(pos>=0)
cout<<"the elements"<<ele<<"is present at position"<<endl;
else
cout<<"the search elements"<<ele<<"is not present''<<endl;
getch();
}
Get Answers For Free
Most questions answered within 1 hours.