lab program abot c

Need help with my Computer Science question – I’m studying for my class.

In this lab, you will write a program in C that uses input, output, function calls, and preprocessor directives by doing some basic mathematical computations. You will also organize your program into separate source and header files.

  • Create a header file named functions.h. In this file, you will do the following:
    • Include the header guards
    • Write a preprocessor directive to represent a constant value for an array size. Name it LENGTH and give the replacement value 5.
    • You will write two functions (see below functions.c. Declare their prototypes.
  • Create a source file named functions.c. In this file, you will do the following:
    • Write a function named average() that solves for the two x values. It takes in an array of integers and its length. It returns the average of the array.
    • Write a function named quadraticFormula() that solves for the two x values. It takes in five parameters: the arguments for the equation a, b, and c plus two parameters passed by pointer so that the both x calculations can be sent back to the caller. Assume all parameters are double‘s. The function returns nothing. Here is the mathematical formula below (source: Wikipedia)
    • alt text
    • Be sure to include functions.h and math.h
    • No printf() statements can exist in this file.
  • Write the main() that will do the following:
    • Declare an array with 5 integer values – use the LENGTH. Using a for loop, ask the user to input a value for each of the array elements. Assume the user will always enter a valid value as input.
    • Then, ask the user for three values for the a, b, and c arguments that will be passed to the quadraticFormula() function. It will pass two additional variables by pointer.
    • Call the average() function with the array and LENGTH and print out the results
    • Call the “quadraticFormula()“` with the arguments and two result variables.
    • After the two function calls, print out the returned values showing up to 2 decimal places. The output must look exactly like this in terms of formatting. The output must look exactly like this in terms of formatting. There is only one space between the colon and the result. Results are shown with exactly two decimal places.
    • Call the average() and standardDeviation() functions and print out the solutions each on a separate line with each value showing up to 2 decimal places. The output must look exactly like this in terms of formatting. The numbers may vary if you are using different array values.

Order this or a similar paper and get 20% discount on your first order with us. Use coupon: GET20