Question
1-D Array - C++ You are to write a program that will manipulate an array. Your program should handle up to 50 integer numbers. You
1-D Array - C++
You are to write a program that will manipulate an array. Your program should handle up to 50 integer numbers. You have to count how many values you read in and you cannot hard code the number of values in the data file. Label the results for each print out below. You will have several different outputs below. Print your results in the same order given below. For each part below, write one or more functions (there are a number of functions). Pass back the values from functions through the return statement (return value) and not through a function parameter. ------------------------------------ 1. Read in the data elements into the array. The input is found in arrayV2.dat (found here: http://pastebin.com/FdFNHJUM) 2. Print out all the data elements in the array with no more than 10 numbers per output line. 3. Print out the average of the array. 4. Print out how many data elements are larger than the average (one value) and how many are smaller than the average (one value). Pass average as a parameter. 5. Print out the data elements in the array that are in the odd position of the array. That is printout ary[1], ary[3], ary[5] . Print only 10 numbers per line. 6. Print out the number data elements in the array that are even values in the array (one value). 7. Convert every negative data elements to a positive number and every positive data element to a negative number. 8. Print out the average of the new array. 9. Swap the first data element in the array with the last data element in the array. Print out the array. 10. How many data elements in the array are multiples of either 7 or 13? 11. Find the largest data element and print out the data element and its array position. 12. Find the smallest data element and print out the data element and its array position. 13. How many values in the array are less than 30? 14. How many values in the array are greater than 75? 15. How many data elements in the array are greater than the 15th data element in the array? 16. Create a second array. Copy all the data elements from the first array to the second array. Print out the second array
17. Now copy all the data elements from the first array to the second array in reverse order. Print out the second array.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started