4. Answer each of the following programming questions (using C++)__(2+2+6) a) Declare a function called Longest...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. Answer each of the following programming questions (using C++)__(2+2+6) a) Declare a function called Longest that takes an array X (of type string) and number of data N as input and that returns the longest string (output type is a string). b) Given a function declaration as below: void Mystery(char X[ ], int m, int n); Where m is the starting index and n represent total number of data in the array. Given a character array as below: char vowels[ ] = {‘a’, ‘e', 'I’, ‘o’, ‘u’}; How will you call the function Mystery for the array vowels? Write down the function call only. c) Given the pseudocode for Binary search algorithm as below: Assume A is an array of integer type. The variables m, n and P are all of type integers. BinarySearch ( A, m, n, P) if m <= n mid ← (m +n)/2 if A[mid] = P return mid else if P < A[mid] else return BinarySearch(A, m, mid-1, P) else return BinarySearch(A, mid+1, n, P) return -1 // close of function Write this function properly in C++ 4. Answer each of the following programming questions (using C++)__(2+2+6) a) Declare a function called Longest that takes an array X (of type string) and number of data N as input and that returns the longest string (output type is a string). b) Given a function declaration as below: void Mystery(char X[ ], int m, int n); Where m is the starting index and n represent total number of data in the array. Given a character array as below: char vowels[ ] = {‘a’, ‘e', 'I’, ‘o’, ‘u’}; How will you call the function Mystery for the array vowels? Write down the function call only. c) Given the pseudocode for Binary search algorithm as below: Assume A is an array of integer type. The variables m, n and P are all of type integers. BinarySearch ( A, m, n, P) if m <= n mid ← (m +n)/2 if A[mid] = P return mid else if P < A[mid] else return BinarySearch(A, m, mid-1, P) else return BinarySearch(A, mid+1, n, P) return -1 // close of function Write this function properly in C++
Expert Answer:
Answer rating: 100% (QA)
For question 4a youre asked to declare a function called Longest which takes an array of strings and ... View the full answer
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date:
Students also viewed these programming questions
-
The Government agencies (GNMA and FNMA) maintain what approximate share of the single-family mortgage origination currently?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
KYC's stock price can go up by 15 percent every year, or down by 10 percent. Both outcomes are equally likely. The risk free rate is 5 percent, and the current stock price of KYC is 100. (a) Price a...
-
If the resultant force acting on the hook is F R = {? 200i + 800j + 150k} lb, determine the magnitude and coordinate direction angles of F. 30 F= 600 ib
-
Microlimp does not raise any new finance during the year, but it generates a lot of earnings, which are immediately reinvested. If you were calculating the company's return on capital, would it make...
-
Sea Scout, Inc., manufactures two types of underwater vehicles. Oil companies use the vehicle called Rigger II to examine offshore oil rigs, and marine biology research foundations use the BioScout...
-
On 1 January 19X6 the following balances, among others, stood in the books of T Thomas: (a) Lighting and heating, (Dr) 277. (b) Insurance, (Dr) 307. During the year ended 31 December 19X6 the...
-
Portland Company's Ironton Plant produces precast ingots for industrial use. Carlos Santiago, who was recently appointed general manager of the Ironton Plant, has just been handed the plant's income...
-
Performance Products Corporation makes two products, titanium Rims and Posts. Data regarding the two products follow: Rims Posts Direct Labor- Hours per unit 0.80 0.60 Annual Production 19,000 units...
-
Formulate a linear program which can be used to generate a comprehensive plan for the whole Far Eastern operations. Clearly define every variable used in your formulation. Start your report with an...
-
Direct material (DM) used in production totaled $820 000. $180 000 of manufacturing overhead (MOH) was applied the production for the month. Total manufacturing costs incurred for the months was $1...
-
Population health management (PHM) is the use of management strategies to improve the health and wellbeing of a defined population, to improve quality, to reduce costs, and to improve workforce...
-
Examine the pull factors of internationalization in the context of Microsoft current issues in china hide a deeper problem in emerging markets.
-
6) Find the determinant of the matrix 0 1 T10 51 -4 509
-
What agile operations factors (visibility, flexibility, speed, predictability, and scalability) do you consider relevantforthe product or servicechosen?
-
How do team composition factors such as diversity in skills, knowledge, and demographics impact team creativity, innovation, and problem-solving capabilities ?
-
Coronado Industries produces a product that requires 2.60 pounds of materials per unit. The allowance for waste and spoilage per unit is 0.30 pounds and 0.10 pounds, respectively. The purchase price...
-
You have just begun your summer internship at Omni Instruments. The company supplies sterilized surgical instruments for physicians. To expand sales, Omni is considering paying a commission to its...
-
Give an example of a column A and a column B such that B is functionally dependent on A. Give an example of a column C and a column D such that D is not functionally dependent on C.
-
For the following exercises, you will address problems and answer questions from management at TAL Distributors. You do not use the TAL Distributors database for any of these exercises. 1. While...
-
What is the system catalog? Name three items about which the catalog maintains information.
-
The following information for Great Oaks Furniture, a retail furniture and design firm, relates to Exercises 6 through 11. Perform a horizontal analysis of the balance sheets and income statements...
-
The following information for Great Oaks Furniture, a retail furniture and design firm, relates to Exercises 6 through 11. Perform a vertical analysis of the balance sheets and income statements for...
-
The following information for Great Oaks Furniture, a retail furniture and design firm, relates to Exercises 6 through 11. Calculate earnings per share, the price-eam- m'ssm jngS ratio, the gross...
Study smarter with the SolutionInn App