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
Sphinxa [80]
3 years ago
7

Modify the selectionSort function presented in this chapter so it sorts an array of strings instead of an array of ints. Test th

e function with a driver program. Use program 8-8 as a skeleton to complete.
Program 8-8

#include

#include

using namespace std;

int main()

{

const int NUM_NAMES = 20

string names [NUM_NAMES] = {"Collins, Bill", "Smith, Bart", "Allen, Jim", "Griffin, Jim", "Stamey, Marty", "Rose,Geri", "Taylor, Terri", "Johnson, Jill", "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", "James, Jean", "Weaver, Jim", "Pore, Bob", "Rutherford, Greg", "Javens, Renee", "Harrison, Rose", "Setzer, Cathy", "Pike, Gordon", "Holland, Beth" };

//Insert your code to complete this program

return 0;

}

Computers and Technology
1 answer:
nirvana33 [79]3 years ago
5 0

Answer:

Following are the method to this question:

void selectionSort(string strArr[], int s) //defining selectionSort method

{

int i,ind; //defining integer variables

string val; //defining string variable

for (i= 0; i< (s-1);i++) //defining loop to count value

  {

      ind = i; //assign loop value in ind variable

      val = strArr[i]; // strore array value in string val variable

      for (int j = i+1;j< s;j++) // defining loop to compare value

      {

          if (strArr[j].compare(val) < 0) //using if block to check value

          {

              val = strArr[j]; //store value in val variable  

              ind= j; //change index value

          }

      }

      strArr[ind] = strArr[i]; //assign string value in strArray  

      strArr[i] = val; // assign array index value

  }

}

void print(string strArr[], int s) //defining print method

{

  for (int i=0;i<s;i++) //using loop to print array values

  {

      cout << strArr[i] << endl; //print values

  }

  cout << endl;

}

Explanation:

In the above-given code, two methods "selectionsort and print" is declared, in which, both method stores two variable in its parameter, which can be described as follows:

  • Insides the selectionSort method, two integer variable "i and ind" and a string variable "val" is defined, inside the method a loop is declared, that uses the if block condition to sort the array.
  • In the next line, another method print is declared that declared the loop to prints its value.
  • Please find the attachment for full code.

You might be interested in
What does it mean to clear a setting in a dialog box?
yaroslaw [1]

Answer:

to delete it

Explanation:

5 0
2 years ago
Debug the following program.
mamaluj [8]

Answer:

The debugged program is as follows:

A=2

B=2

For I=1 to 10

PRINT A

TEMP = A

A=B

B=TEMP+A

NEXT I

END

Explanation:

First, the value of B should be changed to 4 (because the second term of the sequence is 2

Next, change Display to Print because Q-basic uses the print keyword to display output

The sequence is not properly generated. So, I update that part of the program to:

<em>For I=1 to 10 </em>

<em>PRINT A </em>

<em>TEMP = A </em>

<em>A=B </em>

<em>B=TEMP+A </em>

<em>NEXT I </em>

<em />

Lastly, the loop is controlled by variable I (not X).

So change NEXT X to NEXT I

4 0
2 years ago
Just help :(((((((((((((((((((((((((((((((((((
saveliy_v [14]

Answer:

I am sure the answer is A

Explanation:

As you can see from the graph, the first time they pumped air, the numbers were 6, 1.2, and 2. Once they start pumping the numbers decrease. Therefore, I think the answer is A. It went to 5.7, 4, and 2 from 6, 1.2, and 2.1.

5 0
2 years ago
A broker statement is an example of an ___ record
VARVARA [1.3K]

Answer: investment

Explanation:

3 0
3 years ago
Read 2 more answers
You are going to write a program for Computer test which will read 10 multiple choice questions from a file, order them randomly
sweet-ann [11.9K]

Answer:

Code is too large , i attached a source file below and also a text file from where i get Questions

Explanation:

6 0
3 years ago
Other questions:
  • A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
    10·1 answer
  • What is the best use of a line chart? to show parts of a whole while emphasizing specific data to compare and contrast discrete
    9·2 answers
  • What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • Who found the first computer bug in 1947, and invented the concept of a compiler in 1952
    6·1 answer
  • What are the concerns surrounding 5G cellular networks?​
    6·1 answer
  • For each obstacle, select the best solution. failing to find other members for a club: failing a class: failing to get the credi
    9·2 answers
  • Please help I will mark brainliest ⚡️⚡️⚡️⚡️
    12·1 answer
  • Employers are looking for an employee?<br>​
    9·1 answer
  • Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length
    10·1 answer
  • A _____ is the viewing area for a web page, which is much smaller on a phone than on a traditional desktop.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!