insert a file
define a macro
#ifdef, #ifndef, #endif
check to see if a macro has been defined
2.3 include #
Inserts a file or header into the current source code
Software design issues arising in large problems, and C+ constructs aiding in
their solution. Topics include the software life cycle, methods of functional
decomposition, design documentation, abstract data types and classes, common
Used to select code based upon whether a macro has been defined:
/* Compiler is gcc/g+ */
/* Compiler is Microsoft Visual C+ */
#if, #define, and #include
All of these macros are used to redu
4.1. Headers and Compilation Unit Source Files
A typical C+ program is divided into many source code files
Some are headers
Typically end in ".h"
May be #included from many different places
May #include other headers Not directly compiled
5.1. Possible Division
Group everything describing the items intoitems.h and items.cpp.
Group everything describing the bidders intobidders.h and bidders.cpp.
Group everything describing the bids intobids.h and bids.cpp.
A tree is a collection of nodes.
If nonempty, the collection includes a designated node r, the root, and zero or more
(sub)treesT_1, T_2, ., T_k, each of whose roots are connected by an edge to r.
The collection of nodes shown here
Many algorithms for manipulating trees need totraverse the tree, to visit each node in the tree
and process the data in that node. In this section, we'll look at some prototype algorithms for
All of these us
Cs 250 lec 10
2.2. Recursive Traversals
Let's suppose that we have a binary tree whose nodes are declared as shown here.
It's fairly easy to write pre-, in-, and post-order
3.3. General Rules for Decls & Defs
All definitions are also declarations.
But not vice versa
A name must be declared before you can write any code that uses it.
A name can be declared any number of times, as long as the declarations are iden
C+ programs can range from a handful of statements to hundreds of thousands
May be written by one person or by a team
Single file processing
OK for small programs (CS150)
But with large programs
compilation would take min