Phase (1) - In the first phase, you will
take three steps:
Step I: You will define the problem that you want to solve, clearly.
Step II: You will design an algorithm that is precise and very well thought to solve the problem, and
Step III: You will test your algorithm on paper. Your algorithm should work correctly, before you can write a program for it.
Phase (2) -In this phase, you will take
Step I: Translate your algorithm to C++ language. If you have a correct and precise algorithm, the translation should be almost line-by-line. This translation must be correct and free of:
Preparing to Write a Simple C++
Before you can write, compile, and run the first program, you need to learn about several minor issues.
Issue 1: Operating Systems (OS)
Your C++ compiler usually runs on an OS. In this lab, we assume that you will use a Unix or a Unix-like operating system. We have included a short manual for Unix commands. This short manual will give you a list of a very limited number of commands. One can learn more by using other detailed manuals by referring to Unix books and/or by reading the online Unix man pages by typing man <command name> at the command prompt.
Issue 2: Editors
Once you design your algorithm and test it on the paper, you need to use a text editor to type the program. There are several editors that you can use to type your program. The most common text editors are vi, pico, and nedit. Your instructor may ask you to use one of these three or may have another one in mind. We have included two short manuals here; one for vi and the other for pico that will help you with the basic skills that you need to get your program off the ground. If you do not know how to use an editor, we recommend that you get the short manuals that we have provided here or those that your instructor provides to get familiarized with the editor of your choice.
Issue 3: Compilers
Depending on the type of a machine that you will use, you may have a different C++ compiler. GNU C++ compiler is a freeware compiler that many people use. To compile a C++ code, the GNU C++ compiler requires you to type g++ <the program name>. If that command is different on the machine that you are using from now-on instead of g++, use the command that is applicable to your system.
Issue 4: Mail
Throughout the semester, you may need to communicate with the instructor, your classmates, and/or the instructional assistant. There are several e-mail packages on Unix that you can use. You need to find out what package is used for e-mail purposes on the system that you will use for this course.
Now we can go ahead and write the first program.