QUICK REVIEW BASIC ELEMENTS OF C++ Flashcards
is a collection of functions.
C++ program
Every C++ program has a function called
main
starts with the pair of symbols //anywhere in the
line
single-line comment
are enclosed between /* and */
Multiline comments
The _________ skips comments.
compiler
cannot be used as identifiers in a program.
Reserved words
All ___________ in C++ consist of lowercase letters
reserved words
In C++, ________ are names of things
identifiers
A C++ identifier consists of letters, digits, and underscores and must begin with a
letter or underscore.
include blanks, tabs, and newline characters.
Whitespaces
is a set of values together with a set of operations.
data type
C++ data types fall into the following three categories:
simple, structured, and pointers.
There are three categories of simple data:
integral, floating-point, and enumeration.
Integral data types are classified into nine categories:
char, short, int, long, bool, unsigned char, unsigned short, unsigned int, and unsigned long.
The values belonging to int data type are
-2147483648 (-2^31) to 2147483647 (2^31 - 1)
The data type bool has only two values:
true and false
The most common character sets are ________, which has 128 values, and _________, which has 256 values
ASCII and EBCDIC
The ______________ of a character is its preset number in the character data set.
collating sequence
C++ provides three data types to manipulate decimal numbers:
float, double, and long double.
used in C++ to represent any real number
data type float
The memory allocated for a value of the float data type is
four bytes
The memory allocated for a value of the double data type
eight bytes
The arithmetic operators in C++ are
addition (+), subtraction (-), multiplication (*), division (/), and modulus (%)
The ______ operator, %, takes only integer operands
modulus
are evaluated using the precedence rules and the
associativity of the arithmetic operators.
Arithmetic expressions
All operands in an integral expression, or integer expression, are
integers
all operands in a floating-point expression are
decimal numbers
is an expression that consists of both integers and
decimal numbers.
mixed expression
You can use the ____________ to explicitly convert values from one data type to another.
cast operator
sequence of zero or more characters.
string
Strings in C++ are enclosed in
double quotation marks.
A string containing no characters is called a
null or empty string
declared by using the reserved word const.
named constant
Only an ________________________ can change the value of a variable
assignment statement or an input (read) statement
In C++,»_space; is called the
stream extraction operator
Input from the standard input device is accomplished by using
cin and the stream extraction operator»_space;
When data is input in a program, the data items, such as numbers, are usually separated by
blanks, lines, or tabs
In C++, «_space;is called the
stream insertion operator
Output of the program to the standard output device is accomplished by using
cout and the stream insertion operator «
positions the insertion point at the beginning of the
next line on an output device.
manipulator endl
The character \ is called the
escape character
The sequence \n is called the
newline escape sequence
All preprocessor commands start with the symbol
#
are processed by the preprocessor before the program goes through the compiler.
preprocessor commands
instructs the preprocessor to include the header file iostream in the program.
preprocessor command #include <iostream></iostream>
To use cin and cout, the program must include the header file iostream and either include the statement…
using namespace std; or refer to these
identifiers as std::cin and std::cout.
All C++ statements end with a
semicolon
The semicolon in C++ is called the
statement terminator
A C++ system has three components:
environment, language, and the standard libraries
are not part of the C++ language. They contain functions
to perform operations, such as mathematical operations.
standard libraries
A file containing a C++ program usually ends with the extension
.cpp
are executable statements that tell the user what to do.
prompt lines