Wednesday September 8, 2010
Does this compile and if it runs what value will it output?
#include <iostream>
int main(int argc, char * argv[])
{
int i=6;
switch (i) {
case 0:
{int x=9;
break;
}
case 1:
{
int x=10;
break;
}
default:
int x=88;
break;
}
std::cout << "x= " << x << std::endl;
return 0;
}
Answer on Friday!
Monday September 6, 2010

I recently came across an open source version of Command & Conquer Red Alert written in C# and cross-platform via mono. Open-RA is just somebody's hobby project and is still at alpha stage but very impressive and certainly worthy of inclusion in the C# games code.
It's only a 2MB download (the exe) but it fetches 35MB more over the Internet. Although at alpha stage, it supports multi-player play or against bots on your own local server.
So it got me wondering, do you do recreational programming, which includes entering contests on here and elsewhere or are you
working on a project? I think there are a lot of recreational projects out there. As with the projects looking for help, if you want to write a paragraph describing your project, technologies used (only restriction must be C, C++ or C#) and a link to a website or email address and I'll compile a list of them. Meanwhile the Open-RA team is also looking for assistance so if you feel like contributing...
Sunday September 5, 2010

Not one of the best contests with just three entrants but congratulations to James Border whose entry saved 11 houses from immolation by forest fire. Kudos also to Matthew DeKrey for a very nice WPF entry, though it needed to be automatic.
I think the contest confused one or two people, the idea was that you tested it by picking a random point to start a fire, setting it to X before the ten rounds. In the contest I'd modify the source code to a point of my own choosing. I suspect I wasn't clear enough with that.
Anyway Contest 39 is off to a good start with three entries already. I'll start marking those in a day or two and mark throughout September. Keep those entries coming in!
Friday September 3, 2010
I've nothing against Italian food, in fact I love it but did you know Italian food names can apply to programming? It started with Basic programs where "spaghetti" code has jumps all over the place, is convoluted, and has hard to follow logic flow. Spaghetti makes a good analogy and that term is widely known. C code can easily end up like this if care isn't taken. Usually it's made up of massive functions hundreds of
lines long with lots of indentation.
Building on this, other food types can be applied as well so ravioli code is code made up with lots of small loosely coupled objects. It's not bad if the objects are loosely coupled.
Lasagna code is code made up of layers like in lasagna and is the code that binds two layers together. For instance if you have a business objects layer and a database layer, the code that links those two is very much like lasagna code and the layer interface code can get messy. Then there is Spaghetti with meatballs which is a mixture of objects and procedural code, and C++ can be very prone to this.
I wonder what Tortellini code looks like? Lots of loops perhaps?