Program 2: Merge two arrays Write a Pascal program that does the following: 1. Read the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Program 2: Merge two arrays Write a Pascal program that does the following: 1. Read the following two lines of integers from the standard input (such as your keyboard) into two integer arrays: 159 12 16 21 25 3 7 12 13 14 15 16 19 20 26 The numbers are separated by one or more blanks. Keep reading integers until the end of the line. You may assume that there are no errors in the input data and each line of integers is properly sorted in ascending order. Each array should be large enough to hold up to 20 values. 2. Pass each array by reference to a Print routine that prints the array values. 3. Pass the two arrays and a third initially empty array by reference to a Merge routine. The routine merges the two arrays and stores the merged values (which should be sorted) into the third array. The third array should be large enough to hold up to 40 values. 4. Pass the merged array to the Print routine. Program 2: Merge two arrays Write a Pascal program that does the following: 1. Read the following two lines of integers from the standard input (such as your keyboard) into two integer arrays: 159 12 16 21 25 3 7 12 13 14 15 16 19 20 26 The numbers are separated by one or more blanks. Keep reading integers until the end of the line. You may assume that there are no errors in the input data and each line of integers is properly sorted in ascending order. Each array should be large enough to hold up to 20 values. 2. Pass each array by reference to a Print routine that prints the array values. 3. Pass the two arrays and a third initially empty array by reference to a Merge routine. The routine merges the two arrays and stores the merged values (which should be sorted) into the third array. The third array should be large enough to hold up to 40 values. 4. Pass the merged array to the Print routine.
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
Solve the following general system by inverting the coefficient matrix and using Theorem 1.6.2. x1 + 2x2 + 3x3 = b1 x1 - x2 + x3 = b2 x1 + x2 = b3 (a) b1= - 1, b2 = 3, b3 = 4 (b) b1 = - 1, b2 = -1,...
-
Royalton Bookstore ordered 1,000 copies of an introductory physics textbook from Prentice Hall on July 17, 20X0. The books were delivered on August 12, at which time a bill was sent requesting...
-
For what t does the function f (t) = t 2 - 24t have its minimum value?
-
Many firms engage in some form of B2B (business-to-business) Internet-based commerce. Search the Internet to learn about B2B relationships related to payroll processing, and then discuss how a small...
-
Thompson Photo Works purchased several new, highly sophisticated processing machines. The production department needed some guidance with respect to qualifications needed by an operator. Is age a...
-
Shelly's assets include money in checking and savings accounts, investments in stocks and mutual funds, and personal property, including furniture, appliances, an automobile, a coin collection, and...
-
Please complete the attached capital budget worksheet. You MUST create two worksheets one is under the 35% Tax rate and the 20% tax rate. NET CAPITAL SPENDING: 150000 SALES CHANGE % PER YEAR: 1.00%...
-
Magic Realm, Incorporated, has developed a new fantasy board game. The company sold 42,000 games last year at a selling price of $68 per game. Fixed expenses associated with the game total $756,000...
-
At December 31, 2023, Albrecht Corporation had outstanding 228,000 shares of common stock and 10,000 shares of 9.5%, $100 par value cumulative, nonconvertible preferred stock. On May 31, 2024,...
-
Exhibit 1: Sales and Cost Forecast The sales forecast is based on projected levels of demand. All the numbers are expressed in todays dollars. The forecasted average inflation per year is 3.0% Price...
-
A body is given an initial velocity of 40 m s-1 at a point, P. The body decelerates uniformly and attains a velocity of 20 ms at a point, X. The body is finally brought to rest at a point, M. If the...
-
If a company has Current Assets of $287,878, Total Assets of $992,682, Total Liabilities of $359,500. What is its Total Equity?
-
A profit center is the same as a revenue center. (True or False) What do you think? Explain
-
Big Jim Company sponsored a picnic for employees and purchased a propane grill equipped with a standard-sized propane tank for the picnic. To make sure there was enough propane for all the cooking...
-
This project demonstrates how Excel can be used to create a variety of useful documents for small businesses. a. Read the article A Do-It-Yourself Automated Invoicing System, by Jacob M. Rose, which...
-
Modify Table 11-1 by indicating if each specific control procedure listed there is preventive (P), detective (D), or corrective (C) in nature. Table 11-1 Threats and Controls in the Expenditure Cycle...
-
The receiving department at Culp Electronics Company processes inventory deliveries upon arrival by means of online data terminals located on the receiving dock. Each inventory receipt entered into...
Study smarter with the SolutionInn App