Sams Teach Yourself C++ in 21 Days

(singke) #1
something new. The programmer who can offer these alternatives will never suffer from
lack of work; finding less-expensive solutions to today’s problems always generates new
opportunities later.
Assuming you understand the problem and it requires writing a new program, you are
ready to begin your design.
The process of fully understanding the problem (analysis) and creating a plan for a
solution (design) is the necessary foundation for writing a world-class commercial
application.

Your Development Environment ..........................................................................


This book makes the assumption that your compiler has a mode in which you can write
directly to a “console” (for instance, an MS-DOS/Command prompt or a shell window),
without worrying about a graphical environment, such as the ones in Windows or on the
Macintosh. Look for an option such as consoleor easy windowor check your compiler’s
documentation.
Your compiler might be part of an Integrated Development Environment (IDE) or might
have its own built-in source code text editor, or you might be using a commercial text
editor or word processor that can produce text files. The important thing is that whatever
you write your program in, it must save simple, plain-text files, with no word processing
commands embedded in the text. Examples of safe editors include Windows Notepad,
the DOS Edit command, Brief, Epsilon, Emacs, and vi. Many commercial word proces-
sors, such as WordPerfect, Word, and dozens of others, also offer a method for saving
simple text files.
The files you create with your editor are called source files, and for C++ they typically
are named with the extension .cpp,.cp, or .c. This book names all the source code files
with the .cppextension, but check your compiler for what it needs.

14 Day 1


Most C++ compilers don’t care what extension you give your source code,
but if you don’t specify otherwise, many use .cppby default. Be careful,
however; some compilers treat .cfiles as C code and .cppfiles as C++ code.
Again, please check your compiler’s documentation. In any event, it is easier
for other programmers who need to understand your programs if you con-
sistently use .cppfor C++ source code files.

NOTE
Free download pdf