MyLab Programming with Pearson eText -- Standalone Access Card -- for Starting Out With C++: Early Objects (My Programming Lab)
MyLab Programming with Pearson eText -- Standalone Access Card -- for Starting Out With C++: Early Objects (My Programming Lab)
9th Edition
ISBN: 9780134379548
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 15, Problem 1PC
Program Plan Intro

Analysis of Sorting Algorithms

Program Plan:

  • Include the required header files to the program.
  • Define “AbstractSort” class.
    • In public, declare the pure virtual function.
      • In the “get_comparison” function return the total number of comparison.
      • In the “reset_comparison” function reset the comparison value to “0”.
    • In protected, declare the “compare” function.
    • In private, declare the required variable.
  • Define the “compare” function outside the class definition.
    • Inside the function, increment the comparison count and return the number of comparison.
  • Define the derived class “Max_sort”.
    • In public, declare the “sort” function.
  • Define the “sort” function.
    • Get the array of numbers from the main method and swap operation is performed.
  • Define the “main()” function.
    • Declare and initialize the required variables.
    • Get the array value from the user.
    • Check the array value with array index.
      • If the array value is greater than index value exits the program.
    • Initialize the random number generator and generate the random numbers.
    • Create the object for the class “Max_sort”.
    • Call the “sort” function.
    • Display the result.

Blurred answer
Students have asked these similar questions
Using the scenario of Object oriented programming oop Q A designer in 3D graphics company wants to design a matrix as a two-dimensional array. The size of 2D array could be the last two digit of arid number. Initially he creates a class matrix that provides the member function to check that no array index is out of bounds. Make the member data in the matrix class a 10-by-10 array. A constructor should allow the programmer to specify the actual dimensions of the matrix (provided they’re less than 10 by 10). The member functions that access data in the matrix will now need two index numbers: one for each dimension of the array. Here’s what a fragment of a main() program that operates on such a class might look like: If my Arid Number is 20-Arid-254 then: // in case of zero consider next digit matrix m1(5, 4); // define a matrix object int temp = 12345; // define an int value m1.putel(7, 4, temp); // insert value of temp into matrix at 7,4 temp = m1.getel(7, 4); // obtain value…
create using c++ One problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example, you might want to add or delete entries from the array similar to the behavior of a vector . This project asks you to create a class called DynamicStringArray that includes member functions that allow it to emulate the behavior of a vector of strings. The class should have the following A private member variable called dynamicArray that references a dynamic array of type string. A private member variable called size that holds the number of entries in the array. A default constructor that sets the dynamic array to NULL and sets size to 0. A function that returns size . A function named addEntry that takes a string as input. The function should create a new dynamic array one element larger than dynamicArray , copy all elements from dynamicArray into the new array, add the new string onto the end of the new array, increment size, delete the…
(HugeInteger Class) Create a class HugeInteger that uses a 40-element array of digits tostore integers as large as 40 digits each. Provide member functions input, output, add and subtract.For comparing HugeInteger objects, provide functions isEqualTo, isNotEqualTo, isGreaterThan,isLessThan, isGreaterThanOrEqualTo and isLessThanOrEqualTo—each of these is a “predicate”function that simply returns true if the relationship holds between the two HugeIntegers and returns false if the relationship does not hold. Also, provide a predicate function isZero. If you feelambitious, provide member functions multiply, divide and modulus.

Chapter 15 Solutions

MyLab Programming with Pearson eText -- Standalone Access Card -- for Starting Out With C++: Early Objects (My Programming Lab)

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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr