Terms in this set (80)
using namespace std;
which namespace to use
beginning of a function named main
beginning of block for main
send 0 to operating system
end of block for main
inserts the contents of another file into the program
#include lines are not seen by...
a named storage location in memory
variable rule 1
must declare type
variable rule 2
must be defined before it can be used.
declaring a variable =
making the compiler aware of the var.
defining a variable
allocating memory for teh variable
not always defined.
a value that is written into a programs code
program defined name for some part of a program: variables, functions, etc.
First char must be alphabetic or underscore;
alpha, numeric, underscore = OK
upper and lowercase distinct
Mulitword variable name conventions (3)
use camel case for variable definitions:
Use pascal styles for function & class
use underscore uppercase for constant variable definitions
pascal (for function and class declarations)
camel case (for variable definitions)
underscore upper case (constant variable definitions)
2 Data types
number with no fractions
numbers with fractional parts
special memory manipulation to store
integer data types
an integer value typed into a programs code (itemsOrdered = 15)
integer literals are stored
as int by default.
forced storing to long
put L at the end of the number
Constants that begin with 0 are
Constants that begin with 0x are
char is used to hold
characters or small integer values
char stores the ____ of a char
numeric value of asci code
a short is how many bytes?
an int is how many bytes
a long is how many bytes
Char literal examples
97, or 'A' (1 byte)
NOT "A" (2 bytes)
Character strings rule
stored with null terminator \0 at end
signal to system that the string is closed
Character strings (aka)
string class (requires)
#include <string> preprocessor directive
True or false only
bool variables are stored as
floating point datay types (3)
floating point variables can hold
floating point variables store real numbers in
can floating point numbers be unsigned?
float is how many bytes?
double is how many bytes?
long double is how many bytes?
Force to float:
3.14159f (add f at the end)
force to long double
.00000625L (add L at the end of a decimal number)
used to see the size of a variable or data type
how to use sizeof
cout << "a double is stored in " << sizeof(double) << "bytes\n";
item = 12; (convert to speech)
12 is assigned to item
Does the variable always have to be on the left side?
Yes; a variable is an L value.
Initialize a variable (definition)
assign a value to it when it is defined
scope of a variable
the part of the program in which the variable can be accessed
a variable cannot be used (when)
before it is defined.
/* or //
a variable whose content cannot be changed during program execution
named constants (examples)
const double TAX_RATE = 0.0675
YOU MIGHT ALSO LIKE...
Scientific Method & Reasoning - TEAS Science | PrenursingSmarterPro TEAS Guide
4.01- 4.02 Programming
programming 1 understanding variables
C++ (pointer) MULTIPLE CHOICE
OTHER SETS BY THIS CREATOR
Strong Acids and Bases
A&P Ch. 5,6,7,8 Locations and Examples quiz
A&P Ch. 8 Terminology for common bone markings