1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Naya [18.7K]
3 years ago
10

Write a C++ function, lastLargestIndex that takes as parameters an int array and its size and returns the index of the last occu

rrence of the largest element in the array. Also, write a program to test your function.This solution contains errors:#includeint largestIndex(int list[], int listSize);int main(){int alpha[20];cout << "The index of the first occurrence of the largest element in the array is " << largestIndex(alpha,20) << endl;return 0;}int largestIndex(int list[], int listSize){int i;int minIndex = 0; //Assuming first element is the largestfor (counter = 1; counter < listSize; counter++)if (list[maxIndex] < list[counter])maxIndex = counter;return maxIndex;}
Computers and Technology
1 answer:
likoan [24]3 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int largestIndex(int list[], int listSize);  

int main()  

{  

   int alpha[10] = { 3, 6, 2, 6, 4, 1, 0, 5, 4, 2 };

   cout << "The index of the last occurrence of the largest element in the array is " << largestIndex(alpha, 10) << endl;  

   return 0; }

int largestIndex(int list[], int listSize) {

 

   int largestIndex = 0;  

   

   for (int counter = 1; counter < listSize; counter++)

       if (list[counter] >= list[largestIndex])

           largestIndex = counter;

   return largestIndex;

}

Explanation:

The function keeps track of the index of the largest value and updates it when the same or a larger value is found.

You might be interested in
What are some types of vehicle technology advancements?
julia-pushkina [17]

Answer:

D is the suitable answer.

Explanation:

All of the above

5 0
4 years ago
Building relationships during your career exploration is called A. clustering. B. futurecasting. C. matchmaking, D. networking.
Vaselesa [24]
Building relationships during your career exploration is called Networking. 
<span>when you're in career exploration phase, building a relationships with various people may expose you to various kind of opportunities that could benefit your career paths. 

Hope it helped!! :)</span>
5 0
4 years ago
Read 2 more answers
Do not use the scanner class or any other user input request. You application should be self-contained and run without user inpu
nikitadnepr [17]
يتريرينييننيخيوويميمسكيك
6 0
3 years ago
Steve adds a second 1-GB 240-pin DIMM to his PC, which should bring the total RAM in the system up to 2 GB. The PC has an Intel
egoroff_w [7]

Answer:

Option A is correct.

Explanation:

He attaches the second 1 Gigabyte 240 pins DIMM for his system the overall RAM will be up around 2 Gigabytes. System is fitted with Intel Core 2 Dual 3-GHz cpu as well as three 240 pins DIMM ports on the motherboard. Transforms on a system, just 1 Gigabytes of RAM is seen through that RAM count.

Thus, the following issue is much more probably to be the failure to correctly grab that RAM.

5 0
4 years ago
Nancy needs to find the average of two numbers in the middle from an even count of numbers arranged in descending order. which s
Rus_ich [418]

i would say e. the median

7 0
3 years ago
Read 2 more answers
Other questions:
  • Students recently created a Gaming Club at their school. On Friday every week, students bring in their gaming consoles (Xbox, Pl
    7·2 answers
  • What is a file that has an .iso extension? What does this extension indicate?
    8·1 answer
  • 10^4+10-2=<br>10^4+10-2=
    12·2 answers
  • Jamie is preparing a presentation on his laptop for his college annual event. He inserts audio and video files into the presenta
    11·2 answers
  • If a database was being used to track sales, a customer who buys a lot of items would be a good example of how two tables could
    14·1 answer
  • 15. The most efficient way to perform data entry is to keep your hands on the keyboard and press _______ to move to the next cel
    13·1 answer
  • Name the default Package of java<br>​
    8·2 answers
  • Which of the following is a capital resource a computer programmer
    15·1 answer
  • Missing only a few days of school will not impact your grades.
    9·1 answer
  • What are the different types of topology?​ in details
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!