Alfie Parthum's Supercomputing Wonderland - tally

File(s)
Screenshot(s)
Description
tally.tar.gz
tally.md5
All the code from this project, in one nice tar.gz file, along with a README and Makefile! Very nice! Check out the md5 just to make sure....
February 2, 2004 [View tally.md5] - And it's so shiny!
Makefile
This is the Makefile, just in case you wanted to look at it...

I dunno, it just seems to make more sense to me to `make` instead of typing `gcc -o asdfasdfoo-1.2.1 asdfasdfoo-1.2.1.cpp mlug.h -lm -loo` only to realize you wanted to use g++.

February 2, 2004 [View Makefile] - Go ahead, make my day.
randomNumFile.c
randomNumFileCPP.cpp
Task: Compile these two files. Well, I guess I can do that, seeing as to how it's in the Makefile as well....
February 2, 2004 [View randomNumFile.c] [View randomNumFileCPP.cpp] - Hey, it compiled, so it should work....
staticarray.c
staticarrayCPP.cpp
Task: Write C and C++ programs to put 1000 random numbers in a static array.
February 2, 2004 [View staticarray.c] [View staticarrayCPP.cpp] - Get bad with cyber bee
dynamicarray.c
dynamicarrayCPP.cpp
Task: Write C and C++ programs to put however many random numbers you want (yes, you!) in a dynamically allocated array.
February 2, 2004 [View dynamicarray.c] [View dynamicarrayCPP.cpp] - Pokémon, ieru ka na?
algorithms.c
Task: Write a C program based off either the dynamic or static array that will:
  • Find the highest value
  • Find the lowest value
  • Find the standard deviation
  • Sort the numbers

Well, I chose my dynamic array (they're just more awesome and nerve-wracking). Finding the highest and lowest values really shouldn't be that hard to figure out.... and standard deviation is easy, too, if you know how to calculate it: First, find the mean (average) of the data set. Add the squares of the differences between the mean and each data point. Divide that by the number of data points, and then take the square root of that, and you have the standard deviation.

Now, to sort the numbers, I just included stdlib.h and used the qsort function. Hey, it's there for a reason! qsort is called like this:
qsort(void * base, size_t num, size_t width, int(*fncompare)(const void *, const void *))
where base is a pointer to the first element in the array, num is the number of elements, width is the width of each element (usually done just fine using sizeof()), and fncompare is a pointer to a compare function, which looks something like this:
fncompare(const void *a, const void *b)
and will return <0 if a goes before b, 0 if they're equal, and >0 if a goes after b. And that's all there is to it!

February 2, 2004 [View algorithms.c] - And everybody say... YATTA!
tally5.c
Task: Write a program to output a frequency list.
February 2, 2004 [View tally5.c] - Take off every "Zig"
tally6.c
Task: Write a program to output a frequency list. Write a function to find the maximum frequency
February 2, 2004 [View tally6.c] - You know what you doing
tally7.c
Task: Write a program to output a frequency list. Write a function to find the maximum frequency. Write a function that will make an array of the modes.
February 2, 2004 [View tally7.c] - Move "Zig"
tally8.c
Task: Write a program to output a frequency list. Write a function to find the maximum frequency. Write a function that will make an array of the modes. Write a function that will return the kth data frequency.
February 2, 2004 [View tally8.c] - For great justice
Absolutely nothing here is really copyrighted, except the design, which was stolen from a site that no longer uses it anyway. Feel free to narf anything you need, though, as long as it doesn't interfere with any applicable licenses, subsidiaries, city ordinances, et cetera et cetera et cetera. And it never hurts to drop me a line! If you like what you see, you can find more of me at my TJHSST page or my personal domain, The BRPXQZME Network.