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 group actively creates technology recommendation for the web?
xxMikexx [17]

The NETP provides actionable recommendations to implement technology and conduct research and development successfully that can advance the effective use of technology to support learning and teaching.


Hope this helps :)



6 0
3 years ago
Read 2 more answers
You recently completed a network overhaul over the weekend. Everything seems to be functioning properly until you receive a swar
ZanzabumX [31]

Answer:

Network switch has been disconnected or switched off

Explanation:

An organization networking can be done by using several switches, routers, modems, etc. A network switch works between modem and systems, connecting the systems to the network.

A network switch is a multi-port switch that connects multiple devices to the network. mostly every floor has a network switch connected with the floor systems.

When a system is connected to switch, its indicator light on NIC is active. but as per the scenario, no system has active indicator lights on NIC, which means that there is some problem with the switch or switch is powered off.

4 0
3 years ago
An internet address that ends in .com is operated by
ollegr [7]
.com means company, so it is ran by a company.

4 0
3 years ago
Read 2 more answers
Which of these purchases is most likely to be paid for with a credit card
Vesna [10]

Answer:

plane ticket?

Explanation:

7 0
3 years ago
Lenny is a cheese packer at Cheddar Express. He is paid $.52 for every case of cheese he packs and loads onto delivery pallets M
Natali [406]

Answer:

oof.

Explanation:

6 0
3 years ago
Other questions:
  • Which word most strongly appeals to pathos?
    15·1 answer
  • Which group on the sparkline tools design tab would you choose if you wanted to change the data source of the sparkline? (1 poin
    10·1 answer
  • Pls help! ive been looking everywhere online but I couldn't find the answer to this:
    5·1 answer
  • Human factors is the study of:
    5·1 answer
  • The Mail Merge option is located in which tab? a;home b;insert c;refernces d;mailings
    11·2 answers
  • How we know that how many domain exist in window server 2012?
    14·1 answer
  • When an organization uses cloud computing, they do not have to buy and maintain expensive hardware. Group of answer choices True
    6·1 answer
  • If a speaker repeats a point, it is likely _____.
    7·2 answers
  • Use the drop-down menus to complete the steps to share a presentation through OneDrive.
    6·1 answer
  • If you want to share information with individuals who are internal to your organization, which type of network would you want to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!