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
What acronym describes networked devices that contain microcomputers but are not thought of as computing devices, such as refrig
vivado [14]
The acronym RFID (Radio Frequency Identification) describes networked devices that contain microcomputers but are not thought of as computing devices, such as refrigerators, automobile components, light bulbs, and industrial control devices. RFIDs are  battery-powered sensors that gather and transmit data to a reading device. Some sensor based technologies are  scanning electron microscopes, LiDAR,radar, GPS, x-ray, sonar, infrared and seismic.



5 0
3 years ago
The development of a new information system is economically justified if the _____.
ruslelena [56]
The development of new information system is economically justified when or if the organization or group handling the information system has assessed its cost feasibility. If so, this will only fall under the circumstances that the information system is justified economically
3 0
3 years ago
Read 2 more answers
Where should your two index fingers be when your fingers are rest.
PSYCHO15rus [73]

Answer: B : F and J

Explanation: Allows you to type without looking at keys and makes all the keys easily accessible

5 0
2 years ago
How many different bit strings are there of length 8 that contain the string 0000?
Nataly_w [17]

Answer:

answer is 8! / (4! * 4!). Which gives a value of 70.

Explanation:

we have 8 places, we’re going to pick 4 places to put the zeros, it is 8! / (4! x 4!)

3 0
2 years ago
Although there are three well-known operating systems, the most common are Microsoft Windows and Mac OS. Discuss the similaritie
tiny-mole [99]

Answer:

There are very few similarities beyond some convergent features of their respective user interfaces. Their internal architecture is very different, differing from kernel models to shell integration to executable formats. A comprehensive list of similarities is neither possible nor useful, because it would consist mostly of obvious statements like "They are both operating systems" or "They both have graphical user interfaces, "They both include

Explanation:

How's that?

7 0
2 years ago
Other questions:
  • The technical relationship between inputs and outputs, which is needed to understand the difference between the short run and th
    5·1 answer
  • 1. What is the main factor that affects Earth’s average temperature?
    12·1 answer
  • What is a recent technological breakthrough with an impact that can be compared to the invention of paper nearly 2,000 years ago
    8·1 answer
  • Given the integer variables x, y, and z, write a fragment of code that assigns the smallest of x, y, and z to another integer va
    7·1 answer
  • The labels on the tab buttons on the Driver tab of the Windows Device are Driver Details, Update Driver, Roll Back Driver, Unins
    12·1 answer
  • 24 ________ are graphical represenattaion of distribution of data. a) bar graph b) pie charts c) histogram d) frequency chart
    15·1 answer
  • Erik is the president and owner of Watch Out, a local website development company that helps clients create and build unique web
    15·1 answer
  • What are the origins of the parking barrier?
    12·1 answer
  • CAN SOMEONE PLEASE HELP ME OUT I REALLY NEED THE ANSWER!
    14·1 answer
  • Define undo and redo​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!