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
int houses, hotels, total;
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.