You'll need to type them into a file, using whichever editor you're most comfortable with. By convention, a file containing source C++ code should have a filename extension of ".cpp" or ".cxx", while header files to be included should have a filename extension of ".h".
You'll then need a C++ compiler program to turn your code into an executable that can be run.
You don't need an IDE. All you need is a text editor and a compiler, which is what I recommend. If you know how to compile and link from a command line, then you won't be so lost when your IDE spits out errors at you.