Added work from my other class repositories before deletion

This commit is contained in:
2017-11-29 10:28:24 -08:00
parent cb0b5f4d25
commit 5ea24c81b5
198 changed files with 739603 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
stats {-rows|-cols} [input_file]
DONE: Numbers are separated by tabs, lines by newlines
DONE: Check for the correct number of arguments, failure to standard error
DONE: Check whether file is readable, or exists, stderr if not
DONE: -rows and -cols should work for anything that starts with its character eg. -rad would do rows
Stats output to stdout
Exit value for errors should be 1
You can assume each row will be less than 1000 bytes long, unix limits this, but unlimited numbers of rows
DONE: If using temp files, make sure they include process id's in name to allow for simultaneous runs. Remove files when done.
DONE: Use the trap command to catch interrupt, hangup, and terminate signals to remove temp files if terminates unexpectedly
Values and results must be whole numbers, round like normal, 7.5 to 8, 7.4 to 7
DONE: Calculations must be done with expr or commandline tools. No other languages
DONE: For median, sort values and take the middle value. If even, take the larger of the middle two values.
DONE: Must be in a single file.
DONE: You can return an error if there is no input file
HINTS

View File

@@ -0,0 +1,35 @@
% cat test_file
1 1 1 1 1
9 3 4 5 5
6 7 8 9 7
3 6 8 9 1
3 4 2 1 4
6 4 4 7 7
% stats -rows test_file
Average Median
1 1
5 5
7 7
5 6
3 3
6 6
% cat test_file | stats c
Averages:
5 4 5 5 4
Medians:
6 4 4 7 5
% echo $?
0
% stats
Usage: stats {-rows|-cols} [file]
% stats -r test_file nya-nya-nya
Usage: stats {-rows|-cols} [file]
% stats -both test_file
Usage: stats {-rows|-cols} [file]
% chmod -r test_file
% stats -columns test_file
stats: cannot read test_file
% stats -columns no_such_file
stats: cannot read no_such_file
% echo $?
1