Concept explainers
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 18 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: Early Objects (6th Edition)
Starting Out with C++: Early Objects (9th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Modern Database Management
Computer Science: An Overview (12th Edition)
Software Engineering (10th Edition)
- Write a function named fill_array, which takes an array and its size as parameters, and writes the sum of all the elements in the array on each of its elements. For example, if the array contains the elements 1,2,3,4, then the function should write 10, 10, 10, 10 on the elements.arrow_forwardPHP Write a reduce function Write a function reduce($arr, $func) that takes an array and a function as a parameter. The reduce function should apply the parameter function to each element of the array in succession to produce a single result. Note: the current result should always be the first parameter to the function and the next element of the array should always be the second parameter. You may not use the PHP function array_reduce in your solution. For example, the result of the following should be 10. function myMax($current, $new) { return $current < $new ? $new : $current; } $arr = array(10, 5, 3, 5, 1, 2, 5, 7, 4); print("Max: " . reduce($arr, 'myMax') .arrow_forwardC++arrow_forward
- In C++ Write the definition of a void function that has two parameters: an array, and an integer parameter that specifies the number of elements in the array. The functions swaps the first and last elements of the array.arrow_forwardProgramming in Carrow_forwardIn c++ please, The following is specifially where im having trouble 4) Create a function to print out the results for each test.void printExamOverview(int stuGrades[][TOTAL_TESTS], int numStu);This function will call getExamAvgMinMaxGrade() to get the class average, highest/lowest grade for each exam. Then it will save the data in a 2D array defined asarrow_forward
- Use Python to Sovlearrow_forwardWrite in C++ Sam is making a list of his favorite Pokemon. However, he changes his mind a lot. Help Sam write a function insertAfter() that takes five parameters and inserts the name of a Pokemon right after a specific index. Function specifications Name: insertAfter() Parameters (Your function should accept these parameters IN THIS ORDER): input_strings string: The array containing strings num_elements int: The number of elements that are currently stored in the array arr_size int: The number of elements that can be stored in the array index int: The location to insert a new string. Note that the new string should be inserted after this location. string_to_insert string: The new string to be inserted into the array Return Value: bool: true: If the string is successfully inserted into the array false: If the array is full If the index value exceeds the size of the arrayarrow_forwardWhen a sentence is entered, write the most relevant C code in that sentence. You should not write the following 3 rules without changing them. void maxinChar(char sentence[], size: in the given string and at most in the picture string) it is underdrawn. Within this function keep its escapes defense of a character in an array. By parameterizing this array to the findMinIndex and findMaxIndex functions, the set value is returned for the minimum and transition elements in this array. In the sentence given according to the returned values, you talk less and mostly about yourself. int findIndex[] is the smallest element in a given array of integers. The array int findx(Index] overnights inside the largest element in an array of integers given you. -------- Meaning: Enter a sentence: Hello world, welcome to the java programming lesson Max Character: o Minimum Character: jarrow_forward
- C++ Format Please Write a function (named "Lookup") that takes two const references to vectors. The first vector is a vector of strings. This vector is a list of words. The second parameter is a list of ints. Where each int denotes an index in the first vector. The function should return a string formed by concatenated the words (separated by a space) of the first vector in the order denoted by the second vector. Input of Test Case provided in PDF:arrow_forwardin c++ Create a function that takes in a size and creates an array in the function of that size. The array should only contain even numbers. Return the array to main and show how that is done.arrow_forwardin c++ Write a function named “countTheSameAsLast” that accepts an array of pointers to Name objects and its array size. It will go through the array and return how many elements (int) in the array are the same as the last element and whether the first and the last elements are the same or not (bool). Please note that the objects pointed by elements in the array can be either Word or Item objects. Please show how you test with the list of mixed objects.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education