Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a function called readall which receives two parameters which the function calls vals PART III (25 points Write a complete C+ program, including at

write a function called readall which receives two parameters which the function calls vals
image text in transcribed
PART III (25 points Write a complete C+ program, including at least one comment in the function, to do the following. You can assume all input is from the output goes to the screen. You must write a comment on the program and a comment on each function (3 points). d main pro keyboard, and you can assume all Write a main program which declares variables and does whatever is described below. a. First the main program will declare an integer array called nums and an integer n which will hold the number of filled positions in the nums array. Assume the array has room for 50 values b. Then the main a value into n and read n values into the array main program will send nums and n to the function readall (see part 1), which will read c. The main program will send nums and n to the function sortarr (see part 2), which will sort the array into descending order. After the return from the function, the main program will print the new values in the nums array c. The main program will send nums and n to the function make_odd (see part 3), which will change the first n even values in the array to odd numbers and return the number of changes made. The main program will print the changed pums array and also the number of changes made by the function, together with an appropriate message. 1. Write a function called readall which receives two parameters: an integer array which the function calls vals and an integer which the function calls p. The function will read a value into p. The function will then read p data items into the yals array. The function will print the data values as they are stored in the array 2. Write a function called sortarr which receives two parameters integer which it calls m. The function will sort the first m elements of the arr array into descending order Example: Assume the function starts with these values in the arr array: 2 12 4 5 25 8 -3, with m equal to 7. Inside the function, these values will be sorted into descending order, after sorting, the array will hold 25 12 8 5 2-3-4 3. Write a function called make_odd which receives two parameters: an integer array which it calls numbers and an integer which it calls y. The function will change each even value in the first y elements of the array into the next lower odd value. The function will count and return the number of changes made Example: If the array holds the values-4 -3 2 58 12 25, with y equal to 7, the function will change the array to -5-3 1 5711 25, and the function will return 4

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_2

Step: 3

blur-text-image_step3

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

Question

Understand how emergent change occurs.

Answered: 1 week ago