Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program in C Concepts to Practice Arrays . Passing arrays to functions Symbolic constants Expand the prelab Submission Information t by following the instructions given

Program in C image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Concepts to Practice Arrays . Passing arrays to functions Symbolic constants Expand the prelab Submission Information t by following the instructions given by your TA. SUBMIT ONLY the c file (no a.out or executable file is required). Use the following submit command. submit cclass> cassignment> cfilename> e.g.: submit CS1050 Lab_5 c-lab5.c Filename must be: sectionletter-labs.c (Use your lab section for section-letter) e.g. c-lab5.c Description For the lab assignment, you need to define a symbolic constant called LIMIT that will be equal to 10 You should declare two arrays, both of type int in your main) function that have LIMIT elements (note that you must use the symbolic constant in your declaration of each array, as well as every time you need to reference the number of elements in each array). Initialize the first array so that the value of each element is equal to that element's subscript times itself. For example: firstarray[3] -9 (because 9-33) Initialize the second array so that the value of each element is equal to that element's subscript. For example: secondarray(3): 3 You will write a function to do each type of initialization, as described below. Once your arrays are initialized, you should pass them each to PrintArray(), and then pass them together to each of the functions SumArrays() and MultArrays). These three functions are described below. Functions You Must Write You may write any functions you wish to implement this program, in addition to the following functi However, you must implement the following functions: void InitArraySquarelint arrayl, int size) -This function takes an array that has size element The value of each element in the array is set to the value of its subscript squared. void InitArrayLine The value of each element in the array is set to the value of its subscript. arlint arrayll, int size)- This function takes an array that has size elements void PrintArraylint arrayl, int size) -This function takes an array that has size elements. The value of each element in the array is printed tion takes two arrays that e void SumArrays(int array1l1, int array2l, int size) - This func The value of the sum of the corresponding element in the arrays is ach printed have size elements. void MultArrays(int array1ll, int array21, int size)-This functio have size elements. The value of the product of the corresponding element in the arr printed. n takes two arrays that each int main(void)-Of course, you need to write a mainl) . sample Output JirnR@limRAreaS1: /CS JimR@JimRAreas1 a51-ICS1050/sp201 as1-Is10so/sP2019/Labs and Homework/Lab5s Ja.out 19/Labs and Homework/Lab5s compilexlabs Array 1: 49 81 Array 2: Sum of elements of arrays: 12 42 Product of elements of arrays: 27 125 343 512 729 Guidelines for Grading Lab 5 40 Points Possible (+5 bonus points) General If your program does not compile, or produce any input/output /O) because most of the code is commented out then your source credit your C program specifications. lab will receive a grade of NO POINTS. For partial must not only compile but also produce some valid V'O that meets the lab 5 points: Header and general coding style. 5 points: InitArraySquare0 function 5 points: Output matches the sample output correctly. 5 points: InitArrayLinearO function. 5 points: PrintArray0 function. 5 points: SumArrays0 function. 5 points: MultArrays0 function. 5 points: main0 function. BONUS (5 points) Write a new function called InitArrayPower elements. The value of each element in the array is set to the value of its subscript raised to the power specified. void InitArrayPower(int arrayll, int size, int power)-This function takes an array that has size Change your InitArraySquarel) and InitArraylinearl) functions to call IitArrayPowerl) instead

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_2

Step: 3

blur-text-image_3

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

What do you believe was the cause of the turnover problem?

Answered: 1 week ago

Question

5. Arranging for the training facility and room.

Answered: 1 week ago

Question

1. Discuss the five types of learner outcomes.

Answered: 1 week ago