Write a function called showIndex() that takes as parameters an array, its size and a value...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function called showIndex() that takes as parameters an array, its size and a value of type integer. The function must search for the value in the array and then output the index of each array elements equal to that value. For example, if the first parameter is an array that contains (1,7,5,8,7,3,7,6) the second parameter size is 8, and the third parameter is a value equal to 7. The function must print 1, 3 and 6 since 7 exists at these three array indices. Write a main function that declares an array of 8 integers and asks the user to (1) fill the array elements, and (2) enter any integer k. The program calls the above function to show the indices of the array elements where integer k exists. Sample Run: Enter an integer: 1 Enter an integer: 7 Enter an integer: 5 Enter an integer: 8 Enter an integer: 7 Enter an integer: 3 Enter an integer: 7 Enter an integer: 6 please enter value of k: 7 7 occured at index 1 7 occured at index 4 7 occured at index 6 Write a function called showIndex() that takes as parameters an array, its size and a value of type integer. The function must search for the value in the array and then output the index of each array elements equal to that value. For example, if the first parameter is an array that contains (1,7,5,8,7,3,7,6) the second parameter size is 8, and the third parameter is a value equal to 7. The function must print 1, 3 and 6 since 7 exists at these three array indices. Write a main function that declares an array of 8 integers and asks the user to (1) fill the array elements, and (2) enter any integer k. The program calls the above function to show the indices of the array elements where integer k exists. Sample Run: Enter an integer: 1 Enter an integer: 7 Enter an integer: 5 Enter an integer: 8 Enter an integer: 7 Enter an integer: 3 Enter an integer: 7 Enter an integer: 6 please enter value of k: 7 7 occured at index 1 7 occured at index 4 7 occured at index 6
Expert Answer:
Answer rating: 100% (QA)
Here is a code snippet in C c include void showIndexint ... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these computer network questions
-
Submit an annotated outline that includes thematic headings you have drawn from the literature on your topic. The outline must include at least four of the peer-reviewed research articles you found. ...
-
Explain the role of policy in addressing the injustice in community health facilities.?
-
Use the definition of the derivative, f'(x) = lim (x+h) - to find the derivative of f(x) = f'(x)=help (formulas) h0 h Problem 3. (1 point) Use the definition of the derivative, f'(x) = lim f(x + h) -...
-
0 out of 3 points On 30 June 2019, Asahi Ltd has entered into an agreement to lease a beer-making machine to Hite Ltd. The lease agreement details are as follows: . lease term is 5 years estimated...
-
What happens to the brightness of light emitted by a lightbulb when the current flowing through it increases?
-
Alp Inc. had the following activities during 2017: Acquired 2,000 shares of stock in Maybel Inc. for $26,000. Sold an investment in Rate Motors for $35,000 when the carrying value was $33,000. ...
-
Worldview Magazine, Inc., issued \(\$ 700,000\) of 15 -year, \(81 / 2 \%\) convertible bonds payable on July 31,2006 , at a price of 98 . Each \(\$ 1,000\) maturity amount of the bonds is convertible...
-
1. Why didnt money motivate Suzanne Chalmers to stay with API? 2. Do financial rewards have any value in situations such as this, where employees are relatively wealthy? 3. What innate drives seem to...
-
Suppose the function A(x)=0.003257x3 -0.03741x2 +0.1349x+0.008 approximates the blood alcohol concentration in a person's bloodstream x hours after drinking 2 ounces of alcohol on an empty stomach,...
-
Refer to Exercise 13-4. Using the same information, assume that the Brazilian real is identified as the functional currency of the subsidiary. Required: A. Remeasure the account balances that are...
-
Whats Fixed and Variable? Consider the model of labor pooling, with each firm locating either in an isolated site or in a cluster with other firms. Fill the blanks with fixed or variable. a.In an...
-
What are the two primary sources of equity capital?
-
Differentiate between a projects physical life and its economic life.
-
Explain why there is a cost to using reinvested earnings; that is, why arent reinvested earnings a free source of capital?
-
What are some possible reasons that a project might have a high NPV?
-
Explain both the historical and the forward-looking approaches to estimating the market risk premium.
-
Grain Company's general ledger showed a balance of P2,205,600 in its "Cash" account on December 31, 2013. Included in this balance are the following items: DAIF checks returned by bank Saving account...
-
Would you use the adjacency matrix structure or the adjacency list structure in each of the following cases? Justify your choice. a. The graph has 10,000 vertices and 20,000 edges, and it is...
-
Write a MATLAB program that computes the integral using the following methods: (a) Trapezoidal rule (b) Simpsons 1/3 rule (c) Simpsons 3/8 rule (d) Booles rule (e) Fifth-order NewtonCoates (f)...
-
Set up a forward Euler scheme to compute the concentration for a batch reactor with k A+B=C k_1 k2 B+C=D k_2 (4.6.18) (4.6.19)
-
Suppose you are interested in the steady state temperature profile T(x, y) of a square surface with a known spatially dependent thermal diffusivity (x, y) subject to Dirichlet boundary conditions....
-
A semicircular trough of corrugated steel, with diameter \(D=1 \mathrm{~m}\), carries water at depth \(y=0.25 \mathrm{~m}\). The slope is 0.01 . Find the discharge.
-
For a sharp-crested suppressed weir of length \(B=8.0 \mathrm{ft}\), \(P=2.0 \mathrm{ft}\), and \(H=1.0 \mathrm{ft}\), determine the discharge over the weir. Neglect the velocity of approach head.
-
A rectangular sharp-crested weir with end contractions is \(1.5 \mathrm{~m}\) long. How high should the weir crest be placed in a channel to maintain an upstream depth of \(2.5 \mathrm{~m}\) for...
Study smarter with the SolutionInn App