I got bored. So sue me. Redone in C++ (correctly this time, and probably more efficient than
READ MORE »Posts tagged C++
Rotating Bits
Under normal circumstances, you can only ask for a bit rotation using assembly code, however, it is possible to imitate rotation through code. First an explanation on rotating, and bits: Bits, make up bytes. When represented in binary, a bit can be either a 1, or a 0. Nothing more. A byte, is a bunch [...]
READ MORE »Goofy Sort
You know it’s an easy algorithm to program when you’re done writing it, before the teacher is done explaining it… #include "GSort.h" void GSort::sort( int numbers[], int size ) { int i = 0; int previous, current; while( true ) { if( i == 0 ) //No previous, step forward. { i++; continue; } [...]
READ MORE »DiceRoller v2
I decided my first version wasn’t exactly flexible, so I rewrote it to parse out strings of dice rolls and then roll them. /* * dice.c * * Created on: Apr 21, 2009 * Author: Mike Sherwood (coolhand2@gmail.com) * Modified on: Nov 18, 2009 * Author: Mike Sherwood (coolhand2@gmail.com) * Changes: Changed the if-series in [...]
READ MORE »Dice Roller v1
A bit of C code I russelled up to roll a specific die based off the arguments passed to it through the command line. It’s basically just a random number generator with addition properties. /* * dice.c * * Created on: Apr 20, 2009 * Author: Mike Sherwood <coolhand2 @gmail.com> */ #include <stdio .h> #include [...]
READ MORE »C++ Pig Latinizer
After getting immensly pissed at the g++ compiler that I have, I realized I was going about doing things by hand the wrong way. I then took a page out of the php version’s book, and went smaller…
READ MORE »