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
The goal for me is that I need to identify the objects needed for the UNO card game and the actions that those objects perform,
Alik [6]

Answer:

Explanation:

//Java program

class UnoCard{

  private String color;

  private int value;

 

  public UnoCard(String color , int val) {

      this.color = color;

      value = val;

  }

  public String getColor() {

      return color;

  }

  //set the color of the card

  public void setColor(String color ) {

      this.color = color;

  }

  //get the value of the card

  public int getValue() {

      return value;

  }

  //set the value of the card

  public void setValue(int val) {

      value = val;

  }

  //return true if card has same value or

  //same color as the card

  //return false otherwise

  public boolean isMatch(UnoCard card) {

      return (this.value==card.value)||(this.color==card.color);

  }

}

public class Card {

  public static void main(String args[]) {

      UnoCard card1 = new UnoCard("Red",10);

      UnoCard card2 = new UnoCard("Green",10);

      UnoCard card3 = new UnoCard("Blue",15);

     

      if(card1.isMatch(card2))System.out.println("Match");

      else System.out.println("No Match");

     

      if(card2.isMatch(card3))System.out.println("Match");

      else System.out.println("No Match");

  }

}

6 0
4 years ago
1. What cause cable problems? How can these problems be solved?
lukranit [14]

Explanation:

Ageing.

Wrong selection or application.

Mechanical failures.

Corrosion of sheath.

Moisture in the insulation.

Heating of cable.

Fire and lightning surges.

Electrical puncture.

This is the only thing I know that causes cable problems, sorry if it couldn't help you!

4 0
3 years ago
Under which access control system is each piece of information and every system resource (files, devices, networks, and so on) l
Pani-rosa [81]

Answer:

C. Mandatory access control

Explanation:

In the implementation of computer security, the mandatory access control (MAC) refers to the implementation of a security feature by operating systems. In this method, individual resource owners’ are unable to deny or grant permissions to a resources contained in a file. The criteria in a MAC when defined by the system administrator is implemented and enforced by the OS.

7 0
3 years ago
What is the disadvantages of using proprietary software
Snezhnost [94]

Answer:

Cost. One of the biggest drawbacks of any proprietary software is the licensing fee. ...

Developer Support. ...

Security Issues. ...

Customization.

Explanation:

5 0
3 years ago
Read 2 more answers
Why might a business use spreadsheet software for bookkeeping?
Ugo [173]

Answer:

organize and categorize

Explanation:

Spreadsheets are an essential business and accounting tool. They can vary in complexity and can be used for various reasons, but their primary purpose is to organize and categorize data into a logical format. Once this data is entered into the spreadsheet, you can use it to help organize and grow your business.

8 0
3 years ago
Other questions:
  • In three or four sentences, describe how a person buys and sells stock.
    6·2 answers
  • When using a graphics editing program, which option allows you to adjust the space around an image?
    15·1 answer
  • ______________is a collection of technologies for abstracting the details of how applications, storage, network, and other compu
    6·1 answer
  • Which Excel tool adjusts the values in multiple input cells to either maximize, minimize, or reach a specific output value given
    11·1 answer
  • A MAC Frame format has a Preamble of 7 octet pattern in the form of alternating 1s and 0s used by a receiver to establish synchr
    9·1 answer
  • Harry is creating a PowerPoint presentation and wants all the slides to have a uniform look.
    8·1 answer
  • Code the function definition for aNonclassFunction, picking up co. aNonclassFunction has no return value.
    8·1 answer
  • Words or symbols that help you narrow down your search are called:
    12·1 answer
  • What can a user do using the Contact Group dialog box? Check all that apply.
    10·2 answers
  • A class researching the world’s population would like to include a graph that shows historical changes. They have information fr
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!