What usea said. Just issue the commands, don't drag random stuff into the Terminal before you understand what you are doing.
The Terminal is always open at some specific folder. You can see the full name of that folder by typing "pwd". You can move to another folder with the "cd" command, for instance "cd /Users/You/Desktop". If you were already in /Users/You, you could just do "cd Desktop". "cd .." takes you to the parent folder of the current folder.
The underlying assumption in the compile command "g++ -o executable source.cpp" is that source.cpp is in the same folder where Terminal is open. So get to the same folder, and then issue the command. After the compilation succeeds, the compiled program, in this case "executable", will also appear in the same place. You can run it by typing "./executable". The "./" at the start means "the current folder"; without it the Terminal will not try to find the program from the current folder. (It's a security thing.)