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's the purpose of IP
Slav-nsk [51]

Thank you for this question. The answer is that an Ip adress stands fo Internet Protocol which acts like a home adress. Bascily it helps you find a node in a network as the IP adress is made of letters and numbers separated by a full stop. I hope you are happy

4 0
3 years ago
Read 2 more answers
Juan Garcia is the network administrator for a small company that also maintains its own web server. He has taken the following
Lesechka [4]

Answer:

Yes Juan has done enough to secure the network

Explanation:

All the computers are patched, have antivirus software, and have unneeded services shut down - this is done to prevent malware from residing in the system.

The network has a firewall with proxy server and IDS - the firewall limit access to network so as to limit intrusion into the network

The organization has a policy requiring passwords of ten characters in length, and must be changed every 90 days - this is done to prevent leakage of sensitive information in the network especially when there is a compromise in the network.

4 0
3 years ago
To store non-duplicated objects in the order in which they are inserted, use:______
Umnica [9.8K]

Answer:

b. LinkedHashSet

Explanation:

A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. When the iteration order is needed to be maintained this class is used. LinkedHashSet maintains a linked list of the entries in the set, in the order in which they were inserted.

4 0
3 years ago
Business application software programs make it possible to
Daniel [21]
Business application software programs make it possible to: increase productivity in the office setting.
Please give me Brainless if this help!!
6 0
3 years ago
Which Call of Duty game is the best?
love history [14]

Answer:

i like ghost and modern 3

Explanation:

3 0
3 years ago
Other questions:
  • Give two examples of non printing characters
    6·1 answer
  • If the pc­doctor software is installed on a computer's hard drive, what two different ways can the program be started?
    7·1 answer
  • Indicate the time efficiency classes of the three main operations (i.e., FindMax, DeleteMax, and Insert) of the priority queue i
    11·1 answer
  • You want to purchase a new hard drive for your workstation and are deciding between an HDD and an SDD. Which of the following is
    13·1 answer
  • Claire writes a letter to her grandmother, in which she describes an amusement park she visited last week. She adds pictures of
    13·1 answer
  • Your company just installed a new web server within your DMZ. You have been asked to open up the port for secure web browsing on
    5·1 answer
  • Desktop and personal computer are also known as​
    7·1 answer
  • With which feature or menu option of a word processing program can you make an image like this?
    14·2 answers
  • HELPPP PLEASE <br><br> Html can be used to create complicated mobile applications <br> True or false
    10·1 answer
  • Explain how to add cell A1 and cell B3 in excel
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!