This is a project written in C (gcc Linux) of the 21 Card Trick, you can learn about it in wiki-how.
This code does the trick! ;)
There is three files to compile executing
gcc -o trick Trick.h Trick.c main.c
Just start the program
./trick
Check this example where I chose the K♣
Those methods are the heart of the program
Layout(int * v, int n)
Lay out the cards, three across and seven down.
Place(int * v, int n, int c)
Place the group selected in between the other two groups of cards
I write a post about this project in my blog
Abner Díaz @abnerick
This project in under terms of the MIT License