Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with C programming Write a program to perform various array operations. Your program should prompt the user for the array operation and based on

image text in transcribedHelp with C programming
Write a program to perform various array operations. Your program should prompt the user for the array operation and based on the operation it should prompt the user for the necessary inputs from the user, perform the operation, and then display the result. Array operations Sum the elements in an array Increment the elements in an array by one. Change the array values in place (change the elements of the original array) Take the absolute value of the elements in an array (if an array element is negative, negate it) Change the array values in place (change the elements of the original array). Scalar multiply-multiply the elements of the array by a number (scalar) and store the results in another array Window average-for a given window size (a window is a small section of the array), slide the window down the array and compute the average of the elements for each window and store the results in another array (see example below). Exit-stop performing operations 1. 2. 3. 4. 5. 6. Your main function should continuously loop until the user selects the Exit operation (6). Within the loop, your main function should call a function to display the array operation options and input the operation, then use a switch statement to control the operation to be performed. For each case (array operation option), the program should prompt the user for the various inputs (using the input array function to input arrays), perform the operation (by calling the appropriate function), and then display the corresponding result (using the print_array function if needed) When inputting an array, if the user inputs too many values (more than the size of the array), the program should exit (use the exit function with EXIT_FAILURE) You should develop each of the following functions to use in your program. As you develop a function you should create a simple test program to verify that it works properly (you do not need to submit test programs) recommend that you write one to two functions a day and test them as you go to verify that they work. Function: input_operation Description: Display a menu of the different array operation options, input the option, check if it is a valid option and if so, return the option. If the user enters an invalid option the program should loop (use while loop) until the user enters a valid option. Input parameters: none

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

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions