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
Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
marysya [2.9K]

Answer:

The customer's browser has been hijacked by some attackers may be.

Explanation:

According to customer's explanation there is  possibility that that his data may be stolen and he has to disconnect computer from network and then call given number in order to get back his data.

5 0
3 years ago
Create a datafile called superheroes.dat using any text-based editor, and enter at least three records storing superheroes’ name
vitfil [10]

Answer:

Open a text-based editor like Microsoft word, notepad, libraoffice, etc, type the name of the super hero on the first field and the main power on the second field. Then click on the file menu or press ctrl-s and save file as superheroes.dat.

Explanation:

The file extension 'dat' is used to hold data for programs, for easy access. The file above holds data in fields separated by a space and has multiple records.

7 0
3 years ago
Given an array of integers and the size of the array, write a function findDuplicate which prints the duplicate element from the
Jlenok [28]

Answer:

#include <iostream>

using namespace std;

void findDuplicate(int arr[], int size) {

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

      for(int j = i+1; j < size; ++j) {

          if(arr[j] == arr[i]) {

              cout << arr[j] << endl;

              return;

          }

      }

  }

  cout << -1 << endl;

}

int main() {

  int arr[] = {2, 3, 5, 6, 11, 20, 4, 8, 4, 9};

  findDuplicate(arr, 20);

  return 0;

}

Explanation:

5 0
3 years ago
What do u think a creative app must have? <br><br> Please answer the question ASAP!!
jarptica [38.1K]

Answer:

  1. Responsive
  2. Identifies a Target Demographic
  3. Encourages User Engagement
  4. Beautiful UI Design
  5. Follows Platform Design Gipuidelines
  6. Use of Familiar Screens
  7. Functionless Navigation Feature

Explanation:

ÔwÔ

3 0
3 years ago
How to know if somebody else is listening my conversations by cellphone?
weeeeeb [17]
I dont think it would be possible for someone to listen to your calls im pretty sure only the police could if they provide a sign warrent by a judge to the phone company
4 0
3 years ago
Other questions:
  • Upgrading only the motherboard will give some performance improvement to a computer system. Why would the improvement be limited
    14·1 answer
  • Explain briefly why every person in the world is not connected to the Internet.
    9·1 answer
  • How do you think computers have helped improve documentation, support and services within the healthcare industry
    13·1 answer
  • The engineering firm you work for is submitting a proposal to create an amphitheater at a state park. Proposals must be submitte
    15·1 answer
  • )finding an unused location in the hash table is called
    5·1 answer
  • This isn't a question
    8·1 answer
  • VEE Physics 2006 E.C
    7·1 answer
  • Universal containers set the organization-wide defaults for cases to private. When a case is escalated, case ownership changes t
    13·1 answer
  • Which of the following is the file type of Microsoft® Publisher files?
    12·2 answers
  • How will technology help people with disabilities become more transportation independent?.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!