you can use exit(0) or if it is an infinite loop use the keys ctrl+c to terminate any .exe file..
have a good day