This is just a start to the question of how to edit files, such as programs. The choices that you have will depend on where you are working.
It is not a good idea to edit your programs using MS Word or any general word processor. Word processors want to store documents in their own format, not ASCII as we want, and focus on features for users creating printed documents.
Program files can be edited in MS Windows using MS Visual Studio which has a sophisticated programmer-oriented editor. You can even use simple applications such as Notepad.
The editor emacs is a greatly extensible programmer's editor. It is available for Linux and Cygwin, and even for MS Windows. There is a general guide to emacs in the Linux Cookbook in the section on Emacs. It will help you get started. From there you can use the menu to do most of what you want.
If you are working on 172.16.112.48, emacs is already installed and can be started as described in the above reference:
emacs program.cpp
Basic emacs keyboard commands. The control character is indicated with a "C-". It must be pressed while you are pressing the other keys.
A good cheat sheet for emacs.
If you are working on Cygwin you will have to install emacs. It is available under the category of Editors.
Vi is the default editor of UNIX. It is part of all UNIX operating systems and is installed by default in Cygwin.
There is an improved (?) vi for Linux called vim. This is the version that is installed in Cygwin.
There is a general guide to vi in the Linux Cookbook in the section on Vi. It will help you get started. From there you can use the menu to do most of what you want.
If you are using KDE then you can also use the editor Kate. In addition, there is an IDE (Integrated Development Environment) called KDevelop that you might want to try.