and Answers| Latest Update
arrays ✔️✔️are blocks of contiguous memory which all contain the same type of data and which
we access via subscript or numeric index (zero-based) - arrays of intrinsic data types are not
initialized therefore we have to write the code to initialize them when we use them - arrays of
objects have each item in the array initially set to NULL
there are two types of decision-making structures in C/C++ ✔️✔️if statements are for true/false
decision making and switch - case statements are for multiple choice based on integer or
enumerated values
"if" statements are... ✔️✔️for true/false decision making
switch-case statements are... ✔️✔️for multiple choice based on integer or enumerated values
we create new classes either through ____________ or through ________________
✔️✔️inheritance or composition. For example: our Hand and Deck classes are composed of other
classes (arrays of Cards) whereas our Point3D class inherited all the capabilities of the Point2D
class and added the necessary bits to add a third dimension
in the HighScore class we made it so that each HighScore could... ✔️✔️compare itself to another
HighScore and return an integer value which indicated less than (negative), equal to (zero), or
greater than (positive)
in a class the constructor is the only function which has... ✔️✔️no return type and is named
EXACTLY like the class - the constructor allows us to more easily create new objects by passing
default parameters to our newly created objects - Point2D spawn( 45, 65 ); for example
, we use access modifiers to... ✔️✔️control who can see and use different parts of our classes -
private means only our class code can see or use the variables or functions while public means
that those variables and functions are available to other programs which use our classes as well
encapsulation ✔️✔️is the term applied to the idea that a class should be fully self-contained
(encapsulated within itself) - it should have all of the variables and functions it needs for itself
we use the "this" keyword when writing classes to ✔️✔️allow class functions to access the
specific memory variables of a member of that class (Cole's Hand would be able to access his
data while Haley's Hand could only access her specific data)
Why include iostream? ✔️✔️uses the objects cin and cout for sending data to and from the
console
Why include fstream? ✔️✔️File stream: allows us to use both ofstream and ifstream which
means it can create files, write information to files, and read information from files.
Why use sstream? ✔️✔️C++ String Streams. The stringstream, ostringstream, and istringstream
objects are used for input and output to a string. They behave in a manner similar to fstream,
ofstream and ifstream objects.
Why use cstdlib? ✔️✔️Has randomization functions
Why use the ctime library? ✔️✔️Has time function to ask CPU what current time is. Useful for
our random number program.
Why use the cmath library? ✔️✔️Has all math functions like sin, cos, sqrt
classes are... ✔️✔️definitions of a group of like things called objects (abstract constructs)