How to write a program in C++ such that it will delete itself after execution ?
For Windows try this. It is basically launching a .bat file that loops until the destruction is sucessful:
http://www.codeproject.com/Articles/4027/Writing-a-self-destructing-exe-file