answer.
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]
2 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]2 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
All of the following are specific security challenges that threaten corporate systems in a client/server environment except:
Fudgin [204]

Answer:

Option D i.e., radiation is the correct answer.

Explanation:

When any person challenges the specific security system for the purpose of stealing the resources from the corporate security system then they unable to threaten the radiation because it is the electromagnetic waves that affect the body or skin of any human being and it can be generated by those devices that have high-voltage.

8 0
2 years ago
Plz help code practice for python
laila [671]

Answer:umm

Explanation:

6 0
2 years ago
Read 2 more answers
In a ____________________ attack, the attacker sends a large number of connection or information requests to disrupt a target fr
Blababa [14]

DDoS - Distributed Denial of Service

<u>Explanation:</u>

  • In DDoS attack, the attack comes from various system to a particular one by making some internet traffic.
  • This attack is initiated from various compromised devices, sometimes distributed globally through a botnet. It is different from other attacks  such as (DoS) Denial of Service attacks, in which it utilizes an unique Internet-connected device ( single network connection) to stream a target with the malicious traffic.
  • So in DDoS, multiple systems are involved in the attack and hence we can conclude that as the answer.
8 0
2 years ago
Which statements describe the Sort List feature of Word? Check all that apply.
natulia [17]

Answer: It arranges text in a list alphabetically from A to Z.

Explanation: It's always easier and more systematic to arrange alphabetically. With numbers there is the possibility of infinity but not with alphabet which have a defined range.

7 0
2 years ago
Read 2 more answers
The ratio of Chris an iood Dom's ages is
irinina [24]

Answer:

28 years

Explanation:

Let's represent present age of Chris and Dom as C and D respectively. Then since ratio of present age of Chris and Dom is 3:4. Therefore,

\frac{C}{D}=\frac{3}{4}

C=\frac{3}{4}D   ...(1)

Now, it is given that in 7 years their age ratio will become 4:5. Therefore,

\frac{C+7}{D+7}=\frac{4}{5}

5C+35=4D+28\\

Using value of C from equation(1),

5\times\frac{3}{4}D-4D=28-35

15D-16D=-28\\-D=-28\\ D=28

Thus, present age of Dom is 28 years.

8 0
3 years ago
Other questions:
  • A telephone-repair technician uses a meter to measure voltage on a phone line. This meter is an example of _____. hardware softw
    10·2 answers
  • Foods that are high in _________ have the least impact on slowing the body's absorption rate of alcohol.
    5·1 answer
  • Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
    12·2 answers
  • How many frequencies does a full-duplex qam-64 modem use?
    8·2 answers
  • Which references are updated when you copy the formula =$E6-MAX(H$1:J4)
    10·1 answer
  • Mark T for True and F for False. No single person or government agency controls or owns the Internet. The W3C is responsible for
    5·1 answer
  • Develop an EER model for the following situation using the traditional EER notation, the Visio notation, or the subtypes inside
    8·1 answer
  • 14. Emelia is very concerned about safety and has conducted a study to determine how many bike helmets were replaced at each loc
    13·2 answers
  • #Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should
    9·1 answer
  • _____________ data is what is translated to digital format so it can be stored in a computer.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!