1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

Answer to Silly Programming Puzzle

Thursday August 21, 2008
Terrarium2 ScreenshotIt was indeed 9, the value of i that was output. That was despite the deliberately offputting pragmas and #line statements which in this case were window dressing. C# follows on from both C and C++ and other programming languages in letting the programmer manage multiple versions through use of #define, #if etc.

For example you'll find this in Mainform.cs of Terrarium2, a multi-player (and single play) predator prey simulation with developer created creatures. Members of Microsoft's .NET Framework team recently revamped this and you can download the simulator, source code, sdk and server. it's excellent stuff and I've also added the above the link into the C# Games Code Library.

#if !DEVELOPER
    SplashWindow.Current.Image = new Bitmap( typeof(MainForm), "splashscreen.png" ) ;
    SplashWindow.Current.ShowShadow = true;
    SplashWindow.Current.MinimumDuration = 3000;
    SplashWindow.Current.Show() ;
#endif

Comments
August 25, 2008 at 5:09 pm
(1) yaqub ibrahim says:

please i appreciate with this tutorial,but i need more explanation on how to compile.because when ever i execute my program there showing me file not compile so please i will like to know the problem.thanks

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.