Navigate to ideone.com. Select New Code, choose the language you want to see an example for (by using the button towards the bottom left), then select the sample link above the edit window. This will insert an example solution to Test.
If C++ is your thing, you can see different samples by choosing different flavours of C++. The couple I looked at used cin and cout, but you can use other I/O methods that read from stdin and write to stdout.
You can find further examples by browsing this forum and looking at the posted code.