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
To transfer files to your company's internal network from home, you use FTP. The administrator has recently implemented a firewa
Aleonysh [2.5K]

Answer:

Ports 20 and 21

Explanation:

For the FTP to work, there are two parts that are required; the command and the data.  These two parts are sent on the two ports 21 and 20 respectively.  If the firewall is indeed blocking connections on ports 21 and 20, then your FTP will not work.

Hence, you need to open ports 20 and 21 to allow FTP to remain functional.

Cheers.

6 0
3 years ago
A compiler coverts a source code into an object code. true or false​
atroni [7]

Answer:

True

Have a nice day*_*

3 0
3 years ago
Gerry used HTML for his website. Which best describes HTML?
zalisa [80]

HTML stands for hypertext markup language. This explains it quite good. It is a language in which you "describe" your content; you use markup code (HTML tags) to give meaning to the content. In combination with hyperlinks, the text becomes hypertext, creating a "web" of text.

6 0
3 years ago
Read 2 more answers
What is it called if a user disables the built-in limitations on their apple ios device to provide additional functionality?
Usimov [2.4K]

A restriction is a built-in limitation that allow users to disable specific applications to their apple ios device to give additional functionality.

In addition, it also has security feature that could help protect user data if the device is in the hands of those unauthorized user, lost or stolen.

4 0
4 years ago
In Step 7, you listed three elements commonly listed in charts. What are all of those options?
devlian [24]
Common elements in charts, a data series, an x-axis, a y-axis, and
a legend
6 0
4 years ago
Other questions:
  • 1. Write a telephone lookup program. Read a data set of 1, 000 names and telephone numbers from a file that contains the numbers
    14·1 answer
  • How can our perceptions help us to choose the channel for our message?
    5·1 answer
  • A 40 fps(frames per second) video clip at 5 megapixels per frame would generate large amount of pixels equivalent to a speed of
    7·1 answer
  • 14. You can store data copied from any Office application file with the
    14·1 answer
  • What does it mean to catch an exception?
    8·1 answer
  • Community gardens are public gardens where local residents can grow plants in a plot. They are very popular, so there are often
    7·1 answer
  • I need like 10 sentences to delineate and discuss societal issues related to computing . “Including the guiding principles of pr
    9·1 answer
  • 1. What kind of metrics would be useful that are based on testing knowledge after security awareness training? The metrics could
    15·1 answer
  • Describe how people can work in collaboration with technology to create a better world in 200 words or less.
    9·1 answer
  • How might the design be changed so that additional copies of print statements would not be needed?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!