Archive for February, 2011

This post contains the code I wrote recently, of which is used to calculate the amount of money owed to the bank when you get the dreaded “You are assessed for street repairs: $40 per house and $115 per hotel” community chest card during an otherwise spectacular game of everybody’s favourite board game Monopoly. This tiny source, when compiled, will allow you to enter the number of currently owned houses and hotels and it will subsequently return the amount of money you owe the bank in dollars($). This is not so much a practical application, although it is a potential learning resource for people new to the great language C.

The code for “Monopoly Hack.c” is below:

* Monopoly Hack.c
* Created on: 18/02/2011
* Author: Dillon Chaffey
#include stdio.h
#include stdlib.h
int main()
int houses, hotels, total;
char temp[4];
printf(“Enter your current number of houses: “);
printf(“Enter your current number of hotels: “);
printf(“You owe the bank a total of $%d.\n”, total);

This is a rather useless program in its entirety, although by using a modified version of the source above within another program may prove very useful.

I hope to see this source utilized within another program some time soon. Enjoy your newfound C knowledge.


This post is the first of my new section “Chaff’s Code”, and I hope you will find it useful as an addition to a current project or perhaps inspiration toward hitting that keyboard again and writing that program you have had stuck in your head for what feels like months.

The entire source is quite small, although very efficient for demonstration. The source is below:

* Integer Vs. Floating Point Number Demonstration.c
* Created on: 19/02/2011
* Author: Dillon Chaffey
#include stdio.h
int main()
int int_num1, int_num2, int_num3; /* Line to the left declares three integers by using “int” and then naming the integer variables beside it, which are only allowed to be whole numbers, and are separated by commas of course and ended with a semicolon */
float float_num1, float_num2, float_num3; /* Declares floating point numbers (integer variables with a decimal, i.e 1.39 as opposed to an int which would support whole numbers only, separated by commas) */
int_num1 = 30 / 10; /* Both the divisor and dividend are integers. — Declares that the integer variable “int_num1” is now equal to (30 divided by ten), which is 3 */
float_num1 = 30 / 10;
int_num2 = 46.0 * 75; /* Only the dividend is an integer, the divisor is a float (floating point number) */
float_num2 = 46.0 * 75;
int_num3 = 40 / 8.0; /* Declares the equation “40 divided by 8.0”, which equals ‘5.0’ */
float_num3 = 40 / 8.0;
printf(“The integer representation of the equation ’30 / 10′ is: %d\n”, int_num1);
printf(“The float (floating point) representation of the equation ’30 / 10′ is: %f\n”, float_num1);
printf(“The integer representation of the equation ‘46.0 * 75’ is: %d\n”, int_num2);
printf(“The float representation of the equation ‘46.0 * 75′ is: %f\n”, float_num2);
printf(“The integer representation of the equation ’40 / 8.0′ is: %d\n”, int_num3);
printf(“The float representation of the equation ’40 * 8.0’ %f\n”, float_num3);
return 0;


The above code was written by myself in a very short period of time, although the potential assistance it could render to a person new to the C language is limitless, assuming they are interested in the mathematical side of programming.

I hope that this source will help you and others in some way or another. Enjoy your newfound C knowledge.

What would you think of a weekly hacker meeting in Adelaide?

I have been thinking recently that it would be great to have a hacker get-together every week or so, within a close proximity to our home. I searched the Internet and many other forms of advertisement media to find that the only public group of hackers is the hackerspace-adelaide group. I figured since they are more oriented toward the technological side of things (i.e. circuitry, electrical engineering, etc) that a group catered specifically toward the use of computers would be a very valuable one. After all it is certain that you would love to either learn to hack or teach others to hack (ethically, of course) or both.

Send me an E-mail at to let me know what you think. With sufficient replies the group will be started and we can then decide on a meeting place and times.

From the admin at Chafflube’s Tech Blog.

%d bloggers like this: