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
Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
Ilia_Sergeevich [38]
I think it is true (A) 
3 0
3 years ago
_______ make up the basic structure of a relational database with columns containing field data and rows containing record infor
Klio2033 [76]
QR codes make up the basic structure of a relational database with columns containing field data and rows containing record information.
3 0
3 years ago
Read 2 more answers
Will the fcc ruin the internet affect uk
n200080 [17]
No it will not the FCC is a federal owned company by the United States and has no control over any other servers outside of the US
3 0
3 years ago
Mention five importance of taskbar​
sveticcg [70]

Answer:

The taskbar is an element of an operating system located at the bottom of the screen. It allows you to locate and launch programs through Start and the Start menu, or view any program that's currently open.

6 0
2 years ago
You need to fax a portion of a map from a large hard-cover atlas to a client from an internal fax-modem. To fax the map, the bes
Kay [80]
The fax modem is used to send and receive fax messages by only having phone line (fax machine is not required). The scanned documents should be saved as digital file (image or PDF format) in order to be sent. So, in order to send a portion of a map you should first convert the map into digital file and than simply send it through the fax modem. The best way to convert it to a digital file is to use an optical character recognition (OCR). 
6 0
3 years ago
Other questions:
  • Your Economics teacher has asked you to create a chart showing how supply and demand affects the price of gasoline. Which applic
    13·2 answers
  • Why are many otherwise safety-conscious people victims of Internet crime?
    13·1 answer
  • Explain the history of computing of mechanical era
    14·2 answers
  • What is the main role of LDAP?
    14·1 answer
  • 1. Write a query to list the names all products (by product code and name) and the average ordered quantity for each product wit
    9·1 answer
  • Students who respond promptly to e-mails are following which netiquette rule?
    13·2 answers
  • All health information available on the internet is valid. <br> a. true <br> b. false
    6·1 answer
  • Question<br> 1. Who was the first to use an abacus
    6·1 answer
  • I have no idea which one please help!
    6·2 answers
  • You have been asked to advise a group of several universities who want to combine research efforts and store data in the cloud.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!