First of all Hello !!!
I should write an encryption program which open a text file called input.txt read the content and encrypt it. then save the result in output.txt.here is my code :
I can't tell from your question what exactly doesn't work. But one problem I see is your use of ifstream::get in your loop. This function returns EOF once the end of a file has been reaches, but EOF is not guaranteed to be converted to false. You should check for it manually:
By default, ofstream opens in "write" mode, not in "append" mode. So your file will be overwritten each type you open and write something to it, this is every iteration of this loop. You could solve this by opening the file outside of your loop: