Blackhawk SC's Code Snippets Site

Thx for stopping by here. This page is not much, just a few of my source codes zipped up. My old sources appear first. Download them directly below since they're free to the public. The C++ sources are compatible with either Visual C++ 6 or greater or Turbo C++.

Basic stuff - My first few programs as a clueless newbie programmer

Divide program I - All this does is a really simple divide. You learn this stuff in your first day of C++.
Divide program II - Adds a little to the first, I think it's my first use of IF ELSE.
Divide program III - Using DOUBLE this time. Now supports decimals.
Monster Test - First implementation of loops. Checks if this guy is a monster based on the number of heads he has.
Star Generator - I read this AOL chain mail (wayyy back) with ASCII art and that gave me the idea to make this program. It outputs stars in vertical waves until you press a key. Updated recently to make it print out lines better in Windows.
Class Demonstration - Since classes are still pretty hard for me, I made this simple little program that could be duplicated without classes (but it's just an exercise).
Blackjack - I kinda like this program even though it uses only simple while/for loops since it actually requires logic to make. It doesn't let you bet and it doesn't account for the dual nature of Aces, nor the fact that 10 is picked more often than other numbers however. Those are easy to add but I still I won't.
Necklace - This is an implementation of the Necklace Problem. This program uses only loops. I thought at that time the logic is hard. I actually never got it and had to copy off of someone else's code.
VoidSwap - Demonstrates void functions that returns dynamic variables with &.
MassIndex - Yet another void function demonstration. But this program actually is useful for people who think that they are obese.
StructsDem - A demo program that uses structs, two dimensional arrays, also demonstrates constructors. It takes votes for 3 different candidates from 5 precincts, displays total for each candidate and percentage of that total from the overall number of votes cast for all 3 candidates.
Recursion - Two Driver/Worker methods in Java that uses recursion to solve problems. Binaries are not provided for you but if you download JDK you can compile/run these easily. SumUp (driver) does two things, they're explained when you run the driver class. Ticker (driver) is a countdown program that prints out stuff and doesn't return values.


Slightly Advanced - I think the last updates to this page were back in 2000, and most of the C++ programs came in 1999. Well below I'm going to add a little more to this site each time I figure out some nifty things you can do in programming...now that I've gotten more experienced in writing software. You can think of it as mini-tutorials if you want. Yes this page is still really plain, but you're probably not here to check out my mad web programming skills right ;). Note: generally for these code bits I use DMC (free at www.digitalmars.com) for 16-bit native DOS as well as 32-bit Win32 console, TASM for x86 assembly. I'll add compile notes as necessary. You will have to rename .txt to .c/.asm etc...

oostruct.c - Object Oriented Structs - If you're familiar with object oriented programming languages, you may appreciate how objects can contain behaviors, which for one thing, associates a function with a particular object. This program emulates "behaviors" this using structs in C and pointers to functions.
cpuida.asm and cpuidc.c - C to x86 interfacing - As much as people say C gives you full control over your programs, there are still instructions that can only be executed in ASM code. An example of this is going from real to big-real mode in DOS. Another which is demonstrated in these sources is calling the CPUID instruction. You can read about the public Intel instructions on their website. But I prefer writing in C over assembly, so when it comes to doing certain things in x86, I want to be able to just call some routine that's defined in x86 and continue writing my C code. By the way you can also do inline ASM but doing mixed language in the same source file is quite messy. This code starts off in C, then executes the CPUID instruction and returns the values into a buffer. More will be explained in the source comments. Also use this DMC compile command: dmc -Mtasm -mld cpuida.asm cpuidc.c. This assumes you have your system environment variable 'PATH' pointing to where your tasm.exe is. The -mld switch compiles the C code in Large memory model for DOS, which is important.
split.zip - File Splitter - This is pretty straightforward code but it allows for both even segment size splitting, as well as uneven file size splitting, which I saw that a lot of other freeware file splitters didn't have. This one doesn't have a GUI though, so tough. Source is included, and it should compile on almost any Win32 compiler, or maybe even Linux (since it only uses STDLIB functions). Win32 binary included only.
WResizeConsole - Windows "Window-less" Resolution Resize Utility - A pretty straightforward piece of code written in VC++ using only the Win32 API so it should work on all Windows probably 2000 onwards. It simply resizes the primary monitor's resolution to the parameters that you give to it, ie "WResizeConsole 1024 768". The nice thing about it is that it's windowless so you never see any GUI or anything in the taskbar. You can run it via the command console, or create a shortcut pointing to it with the width and height parameters (respectively) in the target. Source will not be provided on this one.
WindowMover - A window mover for Windows. It moves a Window of your choice to a specific X/Y coordinate on your screen and resizes it to a specified height and width. Written in C with the Windows API using Bloodshed Dev C++. Use the command "Mover.exe Title of the Window#X coordinate#Y coordinate#width#height". For example, Mover.exe Mozilla Firefox#10#20#1024#768

Data Structures/Algorithms - This is more typical of stuff you'd encounter at a college level class

Minheap using Linked Lists - All the min/max heap implementations I see online use arrays. But what if you don't know the max size of the heap? Here's an implementation using linked lists written in C. C is nice because it's easily translatable to Java and will also compile with C++ code.

Scripts page (also from 1999-2000), most of these are not written by me

Feel free to email me about whatever, just remove the obvious anti-spam stuff (black[removethisstuff]hawk_sc at lycos d0t com). Also visit my personal site.