Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do part B (selection sort) only Write FORTRAN, C++ programs for the following two problems. a) Determine the following information about each value in a

Do part B (selection sort) only image text in transcribed
Write FORTRAN, C++ programs for the following two problems. a) Determine the following information about each value in a list of positive integers. a. Is the value a multiple of 7, 11, or 13? b. Is the sum of the digits odds or even? c. What is the positive square root of the value? The square root of a number N can be approximated by repeated calculation using the formula, NG - 0.5 * (LG + N/LG), where NG stands for next guess and LG stands for last guess. The initial guess will be the starting value of LG. The program will compute a value for NG using the formula given. The difference between NG and LG is checked to see whether these two guesses are almost identical. If they are, NG is accepted as the square root; otherwise, the new guess (NG) becomes the last guess (LG) and the process is repeated (another value is computed for NG, the difference is checked, and so on). The loop should be repeated until the deference is less than 0.005. Use an initial guess of 1.0. d. Is the value a prime number? You should have at least four function subprograms; label all output. Your input test data is as follows: 3, 105, 3773, 13, 121, 78, 30751, 1233222, 348373443, 8769, 1011, 121 b) Write a function that will merge the contents of two sorted (ascending order) arrays of the type FLOAT values, use an efficient selection sort to sort two arrays first, and then use the merge function. (Your program should not sort whole array after append one array to another array.) The function should not assume that both its input parameter arrays are the same length but can assume that one array does not contain two copies of the same value. The result array should also contain no duplicate values

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

Students also viewed these Databases questions