Question: NOTE: All programs that you write must have comments at the top with the program name, your name, and a sentence describing what the
NOTE: All programs that you write must have comments at the top with the program name, your name, and a sentence describing what the program will do. 1. Write a new program called Lab13A a. Write a void function that receives an array of 10 integers as a parameter and reads a text file (Lab13A.txt) for the values to place in it. It should also print the values of the array all on the same line, separated by spaces. b. Write an int function that receives an array of 10 integers as a parameter and returns the last even number in the array. c. Write an int function that receives an array of 10 integers as a parameter and returns the smallest number in the array. d. In your main method i. Declare an array of 10 integers ii. Call the first function to fill in the array.. iii. Call the other two functions and print their results with labels. 2. Write a new program called Lab13B a. Declare an array of 10 integers and set each array value equal to 5 times its index. b. Print the array all on one line, separated by spaces. c. Add up all the values in the array and print the total. 3. Write a program called Lab13C a. Write a void function with an int array as a parameter that reads the values from a text file (Lab13C.txt) and places the values in the array. b. Write a bool function that receives 3 parameters: an int array, the array length, and an int number. Return true if the number is in the array and false otherwise. c. In the main function, declare an array of 20 integers. Call the function to populate the array, and then print the array (on one line separated by spaces). Ask the user for a number to search for in the array and call the function to search for it. Using the returned value print a statement to say if the number is found or not. 4. Write a program called Lab13D a. Write a void function that receives an array of 20 integers as a parameter. It should read the values from a text file (Lab13D.txt) and fill the array. b. Write a void function that receives 2 arrays of 20 integers as parameters. This function should read through the first array and place any odd values into the second array. Any zeros in the second array should be at the end, so you will need a separate index variable for it. c. In the main function: i. Declare 2 arrays of 20 integers and call the function to fill in the array, sending the first array as the parameter. ii. Fill the second array with 0's. iii. Call the function from step #b sending the two arrays. iv. Print each array with a label to show which it is. Each array should have all its values on one line separated by spaces. Your output should look like this example (although the numbers will be different.) First array: 53 52 45 77 2 32 57 25 4 50 17 42 51 86 81 50 54 14 94 80 Second array: 53 45 77 57 25 17 51 81 000000000000
Step by Step Solution
There are 3 Steps involved in it
Lab13A This program should have three functions readarray This function should read 10 integers from a text file called Lab13Atxt and store them in an array It should then print the values of the arra... View full answer
Get step-by-step solutions from verified subject matter experts
