Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 16, Problem 13RQE
Program Description Answer
While writing a function template, a programmer should use a “type parameter” to denote a “generic” data type.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C++ Code Dynamic Arrays
Operator__________ can be used to downcast base-class pointers safely
PROGRAMMING LANGUAGE: C++
Write a program which has a class named FileHandlerto read StudentName, MarksObtained from the attached picture. The class should have a function which calculates grade for a student and then adds it in a new column i.e. Grade. The grade should be calculated considering the following criteria.
A: 87-100, B+: 80-86, B: 72-79, C+: 66-71, C: 60-65, D: 50-59, F: 0-49
The file should be saved once grade for all students is calculated.
Write the driver program for executing the task.
Chapter 16 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Ch. 16.1 - Prob. 16.1CPCh. 16.1 - Prob. 16.2CPCh. 16.1 - Prob. 16.3CPCh. 16.1 - Prob. 16.4CPCh. 16.1 - Prob. 16.5CPCh. 16.3 - Prob. 16.6CPCh. 16.3 - The following function accepts an i nt argument...Ch. 16.3 - Prob. 16.8CPCh. 16.3 - Prob. 16.9CPCh. 16.4 - Prob. 16.10CP
Ch. 16.4 - Prob. 16.11CPCh. 16 - Prob. 1RQECh. 16 - Prob. 2RQECh. 16 - Prob. 3RQECh. 16 - Prob. 4RQECh. 16 - What is unwinding the stack?Ch. 16 - What happens if an exception is thrown by a classs...Ch. 16 - How do you prevent a program from halting when the...Ch. 16 - Why is it more convenient to write a function...Ch. 16 - Why must you be careful when writing a function...Ch. 16 - The line containing a throw statement is known as...Ch. 16 - Prob. 11RQECh. 16 - Prob. 12RQECh. 16 - Prob. 13RQECh. 16 - The beginning of a template is marked by a(n)...Ch. 16 - Prob. 15RQECh. 16 - Prob. 16RQECh. 16 - Write a function that searches a numeric array for...Ch. 16 - Write a function that dynamically allocates a...Ch. 16 - Make the function you wrote in Question 17 a...Ch. 16 - Write a template for a function that displays the...Ch. 16 - Prob. 21RQECh. 16 - Prob. 22RQECh. 16 - Prob. 23RQECh. 16 - Prob. 24RQECh. 16 - T F All type parameters defined in a function...Ch. 16 - Prob. 26RQECh. 16 - T F A class object passed to a function template...Ch. 16 - Prob. 28RQECh. 16 - Prob. 29RQECh. 16 - Prob. 30RQECh. 16 - Prob. 31RQECh. 16 - T F A class template may not be derived from...Ch. 16 - T F A class template may not be used as a base...Ch. 16 - Prob. 34RQECh. 16 - Prob. 35RQECh. 16 - try { quotient = divide(num1, num2); } cout The...Ch. 16 - template class T T square(T number) { return T T;...Ch. 16 - template class T int square(int number) { return...Ch. 16 - Prob. 39RQECh. 16 - Assume the following definition appears in a...Ch. 16 - Assume the following statement appears in a...Ch. 16 - Prob. 1PCCh. 16 - Prob. 2PCCh. 16 - Prob. 3PCCh. 16 - Prob. 4PCCh. 16 - Prob. 5PCCh. 16 - IntArray Class Exception Chapter 14 presented an...Ch. 16 - TestScores Class Write a class named TestScores....Ch. 16 - Prob. 8PCCh. 16 - Prob. 9PCCh. 16 - SortableVector Class Template Write a class...Ch. 16 - Inheritance Modification Assuming you have...Ch. 16 - Prob. 12PCCh. 16 - Prob. 13PC
Knowledge Booster
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
- C++ language Alter the code found in main.cpp Using the file, add/change the code in the file, but only where indicating you can add or change code. main.cpp #include <iostream> using namespace std; /*The function binarySearch accepts a sorted array data with no duplicates, and the range within that array to search, defined by first and last. Finally, goal is the value that is searched for within the array. If the goal can be found within the array, the function returns the index position of the goal value in the array. If the goal value does not exist in the array, the function returns -1.*/int binarySearch(int data[], int first, int last, int goal){ cout << "first: " << first << ", last: " << last << endl; // YOU CAN ONLY ADD OR CHANGE CODE BELOW THIS COMMENT return -1; // YOU CAN ONLY ADD OR CHANGE CODE ABOVE THIS COMMENT} int main(){ const int ARRAY_SIZE = 20; int searchValue; /* generates an array data that contains: 0, 10, 20,…arrow_forwardIn C++Using the code provided belowDo the Following: Modify the Insert Tool Function to ask the user if they want to expand the tool holder to accommodate additional tools Add the code to the insert tool function to increase the capacity of the toolbox (Dynamic Array) USE THE FOLLOWING CODE and MODIFY IT: #define _SECURE_SCL_DEPRECATE 0 #include <iostream> #include <string> #include <cstdlib> using namespace std; class GChar { public: static const int DEFAULT_CAPACITY = 5; //constructor GChar(string name = "john", int capacity = DEFAULT_CAPACITY); //copy constructor GChar(const GChar& source); //Overload Assignment GChar& operator=(const GChar& source); //Destructor ~GChar(); //Insert a New Tool void insert(const std::string& toolName); private: //data members string name; int capacity; int used; string* toolHolder; }; //constructor GChar::GChar(string n, int cap) { name = n; capacity = cap; used = 0; toolHolder = new…arrow_forwardClass templates also are called _______________types.arrow_forward
- in C++ Write a function that allows you to modify a Planet in the SolarSystem class. You can choose to pass a Planet into this function, or have the function prompt for planet information. Either way, you need to be able to specify the Planet at a specific index to be modified. This is an example of how it could potentially look in the main: // code that declared a SolarSystem the_system// and assigned planetsPlanet p("X", 2000, 4000);int index = 2;the_system.changePlanet(p, index);arrow_forwardin c++ Write a function named createTwoNames that will do the following: - Read in a word and its definition - Create the Word object for that word and definition - Read in an item’s name and its price - Create the Item object for that item - It will return an array of two pointers pointing to these newly created Word and Item objects. It will use try-catch statement to handle the exception. If the user enters an empty or all-blank word or definition or item’s name, it will not create the object(s) and return null for that object only. In another words, it may create 0, 1 or 2 objects. Whenever the error occurs, it must print out the correct error reason: empty or blank (but not both). Note that this function can and will use cin and cout to read in values from the user.arrow_forwardFill-in-the-Blank When declaring objects of class templates, the __________ you wish to pass into the type parameter must be specified.arrow_forward
- c++ pleasearrow_forwardC++ Program You may use the vector and iostream libraries. You are allowed to use three built-in vector member functions (and no others) but you may not have to use them all. The member functions you are allowed to use are size(), at(), and push_back() Write a function that outputs a vector of doubles with each number in the vector separated by a space then a newline after the entire vector is output. The whole vector output should be preceded by a single line saying "Current Vector Contents:". Write a function that takes a vector a doubles and reverses the order of all the elements of the vector. Write a function that fills a vector of doubles with positive numbers using the standard input stream cin, terminate the input when the user enters any negative number. A single output prompt should precede the initial input stating directions for user. Write a main function that creates an empty vector, calls functions from 2 & 3 and calls your output function before and after each…arrow_forwardMemoryManagerFirstFit The MemoryManagerFirstFit class is derived from the MemoryManagerBase class. Based on the TODO entries in memory_manager_first_fit.h and memory_manager_first_fit.cpp, implement the functions as instructed. memory_manager_first_fit.cpp #include "memory_manager_first_fit.h" #include using namespace std; MemoryManagerFirstFit::MemoryManagerFirstFit(int size) { // Set up the list of memory blocks with the info for this initial // unallocated block. memory_block b; // TODO: Fill in the appropriate values here based on the data elements // you added in the header file. // Add the block to the list of blocks m_blocks.push_back(b); } // Allocate a block of memory of the given size // We will walk through our current list of blocks and // find the block with the first fit. int MemoryManagerFirstFit::allocate(int size, string name) { // TODO: Implement the allocate logic here // // Iterate through the current list of blocks // and find the first one that is big enough…arrow_forward
- Description You are provided a skeleton code in the file student_code.c. Some functions are completely implemented, and some are partially implemented. Additionally, you can add your own functions if required. Complete the program as per following details so that we can have functionality as described in the Synopsis above. All the code in single C file. REMEMBER DO NOT USE sleep(). 1. The given code reads the file's content for you and populates a dynamic array of type struct thread with information about the threads. The threads have filled in this list of threads for you. Additionally, you can check the threadCount variable to see how many threads were created using the input file. If more members are needed, you can add them. You might be able to initialise those extra members during file read if you wish to. 2. The main() already contains the code to read threads from input file. However, there is no code to initialize, execute and synchronize threads. You have to perform these…arrow_forwardProgramming Language: C++ I need the codes for arrayListType.h, main.cpp, myString.cpp, myString.harrow_forwardin C++, for classes with pointer member variables, you should include the copy constructor and the ____________________ in the class.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning