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...
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...
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.       ...
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...
Given the following specifications for an array-based unsorted list, implement all of the functions (declared below)...
Given the following specifications for an array-based unsorted list, implement all of the functions (declared below) and a write a driver code to test all of your implementations. // Define a structure to use as the list item struct ListItem { int key; int Data; }; #define MAX_SIZE 50 // Define maximum length of the list class UnsortedArray { private: int head; // Index to head of the list ListItem theList[MAX_SIZE]; // The list public: UnsortedArray(); // Class constructor ~...
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.)...
The Rivoli Company has no debt outstanding, and its financial position is given by the following...
The Rivoli Company has no debt outstanding, and its financial position is given by the following data: Expected EBIT $700,000 Growth rate in EBIT, gL 0 % Cost of equity, rs 10 % Shares outstanding, no 200,000 Tax rate, T (federal-plus-state) 25 % What is Rivoli's intrinsic value of operations (i.e., its unlevered value)? Round your answer to the nearest dollar. $   What is its intrinsic stock price? Its earnings per share? Round your answers to the nearest cent. Intrinsic...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT