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
A security administrator is required to submit a new csr to a ca. what is the first step?
m_a_m_a [10]
If an administrator needs to renew a certificate for a web server he/she should submit the CSR (Certificate Signing Request) to CA.
<span>If a security administrator is required to submit a new CSR to a CA, teh fisrt step the administrator should do is to g</span>enerate a new private key based on RSA.
4 0
3 years ago
What are specific and relevant terms that will help you locate information using an internet search engine?
Liono4ka [1.6K]
I would say A:keywords

Hope this helps

I’m sorry if this is wrong

Have a great day/night
3 0
2 years ago
the term elastic in ec2 refers to the fact that you can easily increase or decrease the number of servers you run to support an
Dvinal [7]

The phrase "elastic" refers to the ability of a user to construct, launch, and terminate server instances as needed while paying per second for active servers.

By giving users control over the physical location of instances, EC2 enables users to reduce latency and increase redundancy. the capacity to acquire resources as needed and to release resources as required. You want to carry out this task automatically in the cloud. Even if an instance becomes ill or based on criteria you specify, Amazon EC2 Auto Scaling will automatically adjust the number of instances in the group to maintain a fixed number of instances.

Learn more about server here-

brainly.com/question/14307521

#SPJ4

6 0
11 months ago
This is not a factor that you should use to determine the content of your presentation. Your audience your goals your purpose yo
aksik [14]

Your technology I believe

4 0
3 years ago
Read 2 more answers
What are the inputs that the model uses to make decisions?
hodyreva [135]

Answer:

It makes the decision better and adds ownership in the implementation

Explanation:

Hope this helps C:

~Chiena

8 0
2 years ago
Other questions:
  • What function does the ALU perform?
    10·1 answer
  • Discus the pros and cons of Internal cloud service and External cloud service for both Infrastructure as a service and Applicati
    11·1 answer
  • System uses a 6-bit 2’s complement signed integer representation. What is the range of decimal values it can represent?
    14·1 answer
  • If you want to emphasize the Greek root of a word in a document, which tool in Microsoft® Word could you use?
    6·2 answers
  • Analyst is investigating proxy logs and found out that one of the internal user visited website storing suspicious java scripts.
    8·1 answer
  • Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. I
    12·1 answer
  • In each iteration, selection sort (small) places which element in the correct location?
    9·1 answer
  • Which do web servers host?<br> Websites<br> Networks<br> Firewalls<br> Zones
    8·1 answer
  • Justin signed a rental agreement for his new condo. How long is his lease? a p e x
    15·1 answer
  • Write an expression that executes the loop while the user enters a number greater than or equal to 0.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!