Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 6PC

String Selection Sort

Modify the selectionSort function presented in this chapter so it sorts an array of strings instead of an array of ints. Test the function with a driver program. Use Program 8-8 as a skeleton to complete.

Program 8-8

#include <iostream>

#include <string>

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;

}

Blurred answer
Students have asked these similar questions
in c language typedef _people {    int age;    char name[ 32 ]  ; } People_T ;   People_T  data [ 3 ]; Using string lib function, Assign  30 and Cathy to the first cell,  Assign  40 and John to the second cell  and Assign 50 and Tom to the third cell
String Manipulation  In this question, you will be implementing the following functions int findChar(char * str, char c); Searches for the character c in the string str and returns the index of the character in the string. If the character does not exist, returns -1 int replaceChar(char * str, char c1, char c2); Searches for the character c1 in the string str and if found, replace it with c2.The function returns the number of replacements it has performed. If the character does not exist, returns 0. int removeChar(char * str1, char * str2, char c); Creates a copy of str1 into str2 except for the character c that should be replaced with ‘*’ For example, if str1=”Hello World” and c=’l’ then the function should make str2=”He**o Wor*d” int isPalindrome(char * str) Checks to see if a string is Palindrome(reversible). If it is, returns 1, otherwise returns 0. A palindrome string reads similarly from left to right and from right to left like madam, level, radar, etc. int reverseString(char…
Exercise Objectives Problem Description Write a program that reads a string and mirrors it around the middle character. Examples: abcd becomes cdab. abcde becomes deCab AhmadAlami becomes AlamiAhmad Page 1 of 2 Your program must: • Implement function void reflect (char* str) which receives a string (array of characters) and mirrors it. This function does not print anything. • Read from the user (in main()) a string and then print the string after calling function reflect(). • Use pointers and pointer arithmetic only. The use of array notation and/or functions from the string.h library is not allowed.

Chapter 8 Solutions

Starting Out with C++ from Control Structures to Objects (9th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License