Here's hello world in C++ as a newbie to the language might write it (after a few unsuccessful tries, naturally):


#include <iostream>
using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}



Looks nice, doesn't it? However, like all pieces of code, it can be improved.


#include <iostream>

int main()
{
std::cout << "Hello World!" << std::endl;
}



We hardly need to include the entire std namespace when we're only using cout and endl, now do we? The return call is also redundant. Having now optimized our code, let's try and make it as short as possible by removing all unneeded whitespace:


#include<iostream>
int main(){std::cout<<"Hello World!"<<std::endl;}



Finally, let's obfuscate our Hello World.


#include<iostream>
int main(){char*hw=".!dlroW olleH";hw+=12;while(*hw!=46)std::cout<<*hw--;}



As you can no doubt see, our "obfuscation" consists simply of re-writing the program to output Hello World using a pointer which iterates backwards, and eliminating all the whitespace. Surely, we can do better by violating a few rules:


#include<cstdio>
main(/*p!*/){{char*hw=".!dl"/*extern"C"*/"roW"
/**/" ol""leH";hw+=12;while(*/*<<\int*/hw!=46)
{putc(*/*/*co/*ut*/hw--,&_iob[1]);};}}//>;^)*/



Beautiful. Believe it or not, the above still compiles and runs without a hitch using Microsoft's C++ compiler and linker. Now for something completely different: Hello World in C#:


public class HelloWorld
{
static void Main()
{
System.Console.WriteLine( "Hello, World" );
}
}



Shortening and obfuscating this is left as an exercise to the reader.