I am looking for a program where I can enter a C++ code snippet in one window, press a button, and get output in another window. Compilation should somehow be hidden behind
Do something like this ? test a C# snippet code by just copying it to the clipboard and then type csc.exe: http://reboltutorial.com/blog/redirect-shell-to-rebol-console/
Just configure your code editor to compile and run your code snippets.
Most code editors have the capability of 'sending' the current buffer/file to an external tool. I configure one editor key binding to compile the current buffer, and another key binding to execute whatever was last compiled (actually to run whatever has the same base filename as the current buffer with an '.exe' extension). My experience is with Windows, but the same or similar can be done on Unix/Linux.
Then it becomes one keystroke to compile and another to run what I jut compiled. This could also easily be just a single keystroke to compile & run, but I have several key bindings set to compile using various different compilers. That way I can easily test snippets using the latest MSVC, MSVC 6, MinGW GCC, Comeau and Digital Mars compilers to check for differences.
Cling (interactive C++ interpreter, built on the top of LLVM and Clang libraries): https://root.cern.ch/drupal/content/cling
I would do it like this:
int main() {
snippitCode();
return 0;
}
void snippitCode() {
// INSERT SNIPPIT HERE
}
In the 'output' window, you can run 'tail -f' on the output file to continuously update when new output arrives.
http://codepad.org/ works nicely for this purpose. By default, it will run what you paste when you hit submit and display the result (or any errors you might have).
Dinkumware has a page for this AND you can choose the compiler
http://dinkumware.com/exam/default.aspx