1/58
Looks like no tags are added yet.
Computer program
Sequence of statements whose objective is to accomplish
a task
Programming
Process of planning and creating a program
3 Control structures
A. Sequence, B. Selection, C. Repitition
Sequence

Binary for 15
0000 1111
Decimal for 15
15
Hex for 15
F
Oct for 15
17
selection

Repetition

==
equal to
!=
Not equal to
<
Less than
<=
less than or equal to
>
greater than
>=
Greater than or equal to
!
Not
&&
AND
||
OR
Function or?
subprogram
Function or subprogram
collection of statements;
when executed, accomplishes somethin
Syntax rules
rules that specify which statements
(instructions) are legal or valid
Semantic rules
determine the meaning of the
instructions
Programming language
a set of rules, symbols, and
special words
Semantics
set of rules that gives meaning to a
language
semantics examples
2 + 3 5 and (2 + 3) 5
are both syntactically correct expressions, but have
different meanings
Single line comment
begin with //
Multiple line comment
/*
You can include comments that can
occupy several lines.
*/
Reserved word symbols (or keywords):
*Cannot be used for anything other than their intended use
int
reserved word
float
reserved word
double
reserved word
char
reserved word
const
reserved word
void
reserved word
return
reserved word
Variable
a memory location whose contents can be
changed
Identifiers
unique names assigned to
variables, functions, classes, structs, or
other entities within the program. They
help identify said entities uniquely
within the code
how do you declare the data?
specify the data type it
will store
int counter;
variable declared ex:
double interestRate;
variable declared ex:
char grade;
variable declared ex:
Identifier
the name of something that appears in a
program
What does an identifier consist of?
Consists of letters, digits, and the underscore character (_).
Is C++ case sensitive?
Yes
Illegal identifier in, employee survey
space in between employee and survey
Illegal identifier in, Hello!
Exclamation point
Illegal identifier in, one + two
plus sign
illegal identifier in, 2nd
cannot begin with a degit
can use a comma in an integer?
no, commas are only used for separating items in a list
3 categories of simple data
integers
floating-point or double
enumeration type
integers
numbers without a decimal
floating-point or double
decimal numbers
enumeration type
user-defined data type
cin
is used with >> to gather input
>>
stream extraction operator
cout
The syntax of cout
cout also called
output statement