Nice one Duoas! Hadn't seen that one before. Had me stumped for a minute...
I'm a fan of tricks that use misdirection as opposed to some funny math. Obviously, anytime you ask someone to pick a number and perform some operations on it, that's suspicious.
I can think of two tricks. One is a funny math trick, the other has to do with misdirection:
Math (old as rocks):
http://www.bored.com/mysticalball/flash/swish04.swf
Misdirection:
I'm not sure how exactly you would translate this into a C++ program, but whatever.
Basically, you and a friend watch this video:
http://downloads.bbc.co.uk/bbcthree/psychic_card_trick/psychic_card_trick.swf
It's a fake ESP testing video. It only works if you're the one who is holding the mouse. I'll explain:
1.) Ivan broadcasts one of the five symbols to your friend. The video pauses at regular intervals, to give you time to ask your friend which symbol they think it is.
2.) Ask your friend which symbol is manifesting itself in their mind.
3.) The play button is actually split up into five different sections, each representing one of the five symbols.
http://www.barryandstuart.com/wp-content/gallery/bns/esp_button.jpg
If you've correctly memorized which sections belong to which symbol, you click the appropriate section - the one your friend has picked.
4.) Make them think they have ESP.