CSCD Homework 2 Compute Median of an Array Solution

$30.00 $24.00

Rules: Your code must use C Language. If your program shows a compilation error, you get a zero credit for this assignment. You have to use gcc compiler. If you turned in a corrupted file or not readable file, you get a zero. If your program gets a segmentation fault error on the cslinux, you…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Rules: Your code must use C Language. If your program shows a compilation error, you get a zero credit for this assignment. You have to use gcc compiler. If you turned in a corrupted file or not readable file, you get a zero. If your program gets a segmentation fault error on the cslinux, you get a zero. So please make sure your program works properly on the cslinux machine.

Problem Description:

I have provide a hw2_student.c, where a main() function has been set up. Please do NOT change anything in the main(). Also you cannot change the signature of the provided functions. If you change, you could lose 70% points as penalty.

You have to write the following two functions that are called in the main(). The descriptions of the functions, regarding parameters, what to do and how to implement, are provided as comments in the source code. PLEASE read these specifications first.

//returns an array of numbers that are entered by a user on standard input.

int * readNumbers( int * total )

//computes the median for the array returned by the function readNumbers().

int computeMedian(int *p, int n)

Submission:

  1. Your completed c file as hw2_student.c,
  2. A simple makefile compiles the code into executable hw2
  3. Run your program against valgrind and include a screenshot of the valgrind report. Also please make sure there is no memory error or memory leak in the report.
  4. Zip up all your source files, the valgrind report and the makefile above into a zip file, name it using our naming convention. Please submit your single zip file on EWU Canvas by following CSCD240-01 Course Assignmentshw2 Submit Assignment to upload your single zip file.

Please input positive integer numbers ( or zero ), input (-1) to finish input:

6 5 0 2 4 -1

The median for the group of numbers you input is: 4

Test Case 1 and output:

Test Case 2 and output:

Please input positive integer numbers ( or zero ), input (-1) to finish input:

-1

No positive number has been input!

Test Case 3 and output:

Please input positive integer numbers ( or zero ), input (-1) to finish input:

4 1 3 2 -1

The median for the group of numbers you input is: 2

CSCD Homework 2 Compute Median of an Array Solution
$30.00 $24.00