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
natka813 [3]
3 years ago
9

Write a void function SelectionSortDescendTrace() that takes an integer array, and sorts the array into descending order. The fu

nction should use nested loops and output the array after each iteration of the outer loop, thus outputting the array N-1 times (where N is the size). Complete main() to read in a list of up to 10 positive integers (ending in -1) and then call the SelectionSortDescendTrace() function.
If the input is:

20 10 30 40 -1
then the output is:

40 10 30 20
40 30 10 20
40 30 20 10
Computers and Technology
1 answer:
salantis [7]3 years ago
8 0

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

void SelectionSortDescendTrace(int numbers[], int numElems) {

int maxInd;

for (int i = 0; i < numElems - 1; ++i) {

maxInd = i;

for (int j = i; j < numElems; ++j) {

if (numbers[j] > numbers[maxInd]) {

maxInd = j;

}

}

int temp = numbers[i];

numbers[i] = numbers[maxInd];

numbers[maxInd] = temp;

for (int j = 0; j < numElems; j++) {

cout << numbers[j] << " ";

}

cout << endl;

}

}

int main() {

int numbers[10];

int numElements = 0;

for (int i = 0; i < 10; i++) {

cin >> numbers[i];

if (numbers[i] == -1)

break;

++numElements;

}

SelectionSortDescendTrace(numbers, numElements);

return 0;

}

You might be interested in
Which source would provide the best way to find valid information about climate change
igor_vitrenko [27]
Primary sources would be best
4 0
2 years ago
True or false. Every word has only one correct spelling and pronunciation.
iren2701 [21]
<span>Every word has only one correct spelling and pronunciation.
This is a false statement.
</span>
6 0
3 years ago
What is the primary difference between 3g and 4g cellular systems? 4g systems have greater transmission speeds. 3g systems are u
noname [10]
I believe the correct answer is the first option. The primary difference between 3g and 4g cellular systems would be that 4g systems have faster transmission as compared to 3g. The G would mean generation. The very difference of both is their speeds.
4 0
3 years ago
The windows troubleshooting utility that identifies and eliminates nonessential files is called _____.
Virty [35]
I think it is Defragment
8 0
3 years ago
Read 2 more answers
Need to know? Anyone feel like helping me not fail
8_murik_8 [283]
I’m not sure but i think it might be design
4 0
3 years ago
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • Which of the following dimensions of e-commerce technology involves the integration of video, audio, and text marketing messages
    11·1 answer
  • Select the correct answer.
    6·1 answer
  • Testing for information would be most likely to occur in which type of engineering?
    5·2 answers
  • ______ is a type of computer software that is installed into devices such as printers, print servers, and various types of commu
    5·1 answer
  • __________ are hosted on dedicated computers known as 'web servers'.​
    8·2 answers
  • Simplify 0.2×0.03055 to 3 decimal places​
    15·2 answers
  • Plz answer this....quickkkkk​
    7·2 answers
  • What is white light?
    12·2 answers
  • What will help the programmer understand what’s going on in the program?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!