Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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: 1 5 9 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: 1 5 9 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions