Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Answer these questions with your own words, ideas and C++ code. Short essay answers should strive to express your ideas clearly and effectively in 1-3 paragraphs

Instructions:

Answer these questions with your own words, ideas and C++ code. Short essay answers should strive to express your ideas clearly and effectively in 1-3 paragraphs. Programming exercises must be complete, compile without errors and accurately solve the problem. Please place all solutions in an MS Word compatible document for submission. Source code should also be zipped up and submitted. Seek assistance from your professor as needed prior to submitting your assignment.

1. Write a function that takes an array of integers as a parameter and returns the sum of odd numbers in the array. Assume the array has MAX elements where MAX is a global constant integer. This means that before all of the functions there should be a declaration like:

const int MAX = 10;

And arrays are declared like:

intmyArray[MAX];

Note: if you are having trouble with the array questions, be sure to work through the “Building Block” problems in this module first.

2. Rewrite your answer to the previous question as a recursive function.

3. Use a sorting algorithm of your choice to sort an array of at least 25 elements. Your text describes insertion sort in section 7.8. If you use another method, be sure to cite your source material. Write a main method that demonstrates your solution.

4. Write a function that is passed two parameters: a one-dimensional array of int values, and an integer value. The function finds the value in the array that is closest in value to the second parameter.

For example, if the array had the values {5, -3, 18, 9, 4} and the second parameter was 11, then the function would return 9, because 9 is the closest value in the array to 11.

If two values are equally distant, return either. In the previous example, if the second parameter was 7, either 5 or 9 could be returned.

Assume the array has MAX elements where MAX is a global constant int.

5. Read in 20 numbers from a user, each of which is between 30 and 90, inclusive. As each number is read, validate it and store it in an array if and only if it is not a duplicate of a number already read. After reading all the numbers, show only the unique values. For example, if 35 was entered three times, show it just once. Use one single array of the smallest possible size to solve the problem. You may use as many functions as desired.

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"