Skip to content

Glavin001/CSCI3431-simpleStats

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSCI3431 - Assignment 1 - MMMExample

Goal: A simple C program to calculate the mean and median of input numbers.


Intro

You have been given code that reads numbers as command line arguments and sorts them. Create a copy of sort.c named mm.c. Change mm.c to implement the following features.

  • Add a function, mean(), to mm.c to calculate the mean
  • Add a function, median(), to mm.c to calculate the median
  • Make mm.c fork(), have the parent call mean() and child call median()
  • Child should print the results of median()
  • Parent should print the results of mean()
  • Make the parent wait until child has finished before printing results of mean()

Each feature listed above has a corresponding issue. Please use smart commits to address each issue.

Compile

./build.sh

Usage

For example:

$ ./bin/mmm 13 18 13 14 13 16 14 21 13
Median:	14.000000
Mode:	13
Mean:	15.000000

About

Calculates the mean and median of input numbers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.9%
  • Shell 2.1%