I just use the terminal for such one-offs. I'm in linux, so:
g++ -o executable_name the_file.cpp
./executable_name
And voila! But, yeah, once you use code::blocks you have incurred an overhead and why fight the framework? I just make a folder for the simple little one-off scripts, and then in the same folder I will also start projects. It's easy to tell them apart.