I believe that what you're seeing in ls are temporary files and are being automatically hidden by the Desktop. The files with ~ at the end are sometimes created by text editors and other programs which edit things. The system does not automatically remove them, and some programs don't autoremove them. Some programs will remove the files, but others won't. The files are still there because nothing removed them.

You can remove those pretty easily, however this command here to do so has not been tested thoroughly by myself so be careful with using this:

cd ~/Desktop
rm *.cpp\~ *.c\~ Untitled*

I am uncertain whether those are being automatically hidden in the desktop, however that is what I believe is happening based on what you've said.