Question

Given the following array, add the each element corresponding to its position to form a new...

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

Homework Answers

Answer #1

#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();

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given the following array named 'array1': array1 DWORD 50h, 51h, 52h, 53h Write instructions to swap...
Given the following array named 'array1': array1 DWORD 50h, 51h, 52h, 53h Write instructions to swap the items in array1 (using only MOV and XCHG instruction), so that the array1 become: 53h, 51h, 50h, 52h ( That means the first item in the array is 53h, second item is 51h, third item is 50h, forth item is 52h). You can use registers to perform the MOV and XCHG operation.   Write the code to perform above mentioned transformation.
Given the following code: public void expand(Object a) {     // assume element has enough capacity...
Given the following code: public void expand(Object a) {     // assume element has enough capacity     for (int i = size - 1; i >= 0; i--) {         element[4 * i + 3] = a;         element[4 * i + 2] = a;         element[4 * i + 1] = a;         element[4 * i] = element[i];      }      size = 4 * size; } element is a one-dimensional array that stores elements of the type Object....
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number...
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number in A and an O(log n)-time computation for each odd number in A. What is the best-case running time of Algorithm X? What is the worst-case running time of Algorithm X? 2. Given an array, A, of n integers, give an O(n)-time algorithm that finds the longest subarray of A such that all the numbers in that subarray are in sorted order. Your algorithm...
Question 1: Write the following method that returns a new ArrayList. The new list contains the...
Question 1: Write the following method that returns a new ArrayList. The new list contains the nonduplicate elements from the original list, public static <E> ArrayList<E> removeDuplicates(ArrayList<E> list) Question 2: Implement the following method that returns the maximum element in an array: public static <E extends Comparable<E>> E max(E[] list) Each question is its own code and it must be able to run. Please show details . Thank you in advance!
1. An array has an index of [5] at the starting address of 200. It has...
1. An array has an index of [5] at the starting address of 200. It has 3 words per memory cell, determine loc[3],loc[4] and NE. (3 Marks: 1 mark for each) 2. A 2-D array defined as A[10 , 5] requires 4 words of storage space for each element. Calculate the address of A[4,3] given the base address as 250 • If the array is stored in Row-major form • If the array is stored in Column-major form 3. Write...
The C++ program steps through the array x[]. For each i, if x[i] < x[i+1], i...
The C++ program steps through the array x[]. For each i, if x[i] < x[i+1], i is saved in the array ascend[], in order. Compile and run the program; it should print 0 4 5. In this exercise, you’ll try to translate the C++ program to MIPS. Some of the more tedious parts are already given in Assignment3.F19.s. You won’t have to write the data allocation sections, some of the initializations, and the output loop at the end. So the...
Rising Tide, Inc. has no debt outstanding, and its financial position is given by the following...
Rising Tide, Inc. has no debt outstanding, and its financial position is given by the following data: Assets (market value = book value) $6,500,000 EBIT $800,000 Cost of equity 8% Stock price $16 Shares outstanding 406,250 Tax rate 35% The firm is considering selling bonds and simultaneously repurchasing some of its stock. If it moves to a capital structure with 20% debt based on market values, its cost of equity will increase to 9% to reflect the increased risk. Bonds...
Finish the code wherever it says TODO /**    * Node type for this list. Each...
Finish the code wherever it says TODO /**    * Node type for this list. Each node holds a maximum of nodeSize elements in an    * array. Empty slots are null.    */    private class Node {        /**        * Array of actual data elements.        */        // Unchecked warning unavoidable.        public E[] data = (E[]) new Comparable[nodeSize];        /**        * Link to next node.       ...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b,...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b, where a – b is equal to a given number. For example, consider the following array and suppose we want to find all pairs of integers a and b where a – b = 3 A = [10, 4, 6, 16, 1, 6, 12, 13] Then your method should return the following pairs: 4, 1 15, 12 13, 10 A poor solution: There are...
Factor Company is planning to add a new product to its line. To manufacture this product,...
Factor Company is planning to add a new product to its line. To manufacture this product, the company needs to buy a new machine at a $511,000 cost with an expected four-year life and a $19,000 salvage value. All sales are for cash, and all costs are out-of-pocket, except for depreciation on the new machine. Additional information includes the following. (PV of $1, FV of $1, PVA of $1, and FVA of $1) (Use appropriate factor(s) from the tables provided.)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT