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 is the importance of using the proper markup language?
Klio2033 [76]

the answer is D. without the right tags the content wont be accurately indexed

3 0
4 years ago
Read 2 more answers
What are some signs that could help you determine that a date and time was inserted as a special object instead of
Jlenok [28]

Answer:

i) It is difficult to put the mouse pointer's insertion point in the text

ii) A gray border appear around the time and date when you point to it

Explanation:

When the date and time is pointed to or hovered using the mouse pointer, we have, that the background of the text changes to a grey border around the text when the date and time is inserted as a special object using the insert date and time button on the insert menu in the word processing application

The mouse pointer behaves different when working with some applications, and it could be difficult to place the insertion point of the mouse pointer in the  text

Therefore, the correct options are;

<em>It is difficult to put the mouse pointer's insertion point in the text and</em>

<em>A gray border appear around the time and date when you point to it.</em>

3 0
3 years ago
Which of the following resources is an example of a web-based application?
kompoz [17]
The answer will be google docs since it depends on a web and its an application. hope it helps

3 0
4 years ago
What tool is included with windows 8 that will help you connect to the directaccess server when you have problems and can be use
Elina [12.6K]
None that I know. Many third party apps.
4 0
4 years ago
This script should:
denis23 [38]

Answer:

the answer is d

Explanation:

5 0
3 years ago
Other questions:
  • To insert a clip art you must do the following
    14·1 answer
  • Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting
    8·1 answer
  • Does a soda vending machine Give reciepts?<br><br>need for computer science hw
    7·2 answers
  • Which button would you use to quickly add addresses to a mail merge envelope?
    5·1 answer
  • The computer mouse is used to
    7·1 answer
  • If you wanted to include a chart in the new slide you are getting ready to create, you would most likely
    9·1 answer
  • What should you do if you forget your root password for MySQL?
    13·1 answer
  • To quit, a user types 'q'. To continue, a user types any other key. Which expression evaluates to true if a user should continue
    7·1 answer
  • What programming language does the LMC 'understand'?
    5·1 answer
  • The objective fuction of linear progrmming should be
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!