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
Is the weegy face real?or is it computer generated?
allsm [11]
Weegy face is known to be a computer generated program that was designed well by expert developers. It's a type of image that usually works whenever you use the Internet Explorer, and works most of the time on that browser.
3 0
3 years ago
allan is writing a book about rain forests of south america. he plans to spend a few months there and requires an internet conne
madam [21]

Answer:

Satelite

Explanation:

But which is best, satellite, ISDN, fixed wire(Cable), or mobile wireless? The answer depends on what you’re looking for in terms of price and speed—and where you live.

Satellite internet is a great option for rural-area residents (Remote) because it’s available virtually anywhere. Internet speeds can range from 12 to 100 Mbps.

8 0
3 years ago
The beginning balance of Keyshawn's savings account for the month of September was $3900, and it remained this way for the first
Doss [256]
I’m not gonna wanna was that 638
4 0
3 years ago
COMO DEFINES LAS PALABRAS COMPUTADOR Y DISPOSITIVO? MENCIONA EJEMPLOS
Basile [38]

Explanation:

es una máquina digital programable que ejecuta una serie de comandos para procesar los datos de entrada, obteniendo convenientemente información que posteriormente se envía a las unidades de salida. Una computadora está formada físicamente por numerosos circuitos integrados y varios componentes de apoyo, extensión y accesorios, que en conjunto pueden ejecutar tareas diversas con suma rapidez y bajo el control de un programa (software).

3 0
3 years ago
What is the appropriate guidelines to create and manage files
Maurinko [17]

Answer:

1. Do not copyright

2. Nothing illegal

3.Do not put personal info

Explanation:

3 0
3 years ago
Other questions:
  • In a word processor, Tariq chooses Options from the Tools menu and then selects the Track Changes tab. Which of the following ta
    14·1 answer
  • Jennifer’s company currently uses Windows Active Directory to provide centralized authentication, authorization, and accounting
    7·1 answer
  • Which route of entry could chemicals use to enter through the body’s airways?
    8·1 answer
  • Describe the procedure for creating a table or spreadsheet in a presentation slide.
    7·2 answers
  • Which should be addressed by stakeholders when reviewing the problem statement? Select all that apply. All possible outcomes hav
    12·1 answer
  • Q: Why can't I log in to Brainly
    13·1 answer
  • State three advantages of using a printer​
    15·1 answer
  • I have crummy WiFi and a bad pc. If I get a gaming computer, will it improve my FPS or ping?
    14·2 answers
  • Types of Hazards Mitigation Measures
    8·2 answers
  • To verify a Windows system meets the minimum processor and memory requirements to install software, use the ________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!