C++ Midterm Review TJC Vocab words

Coding

is the process of translating a computer solution into a language a computer can understand

machine language or machine code

Instructions written in 0s and 1s

The sequence structure

directs the computer to process the program instructions, one after another, in the order listed in the program

An algorithm

is a set of step-by-step instructions that accomplish a task

Selection structure

makes a decision and then takes an appropriate action based on that decision Also called the decision structure

Repetition structure

directs computer to repeat one or more instructions until some condition is met - Also called a loop or iteration

Output
(cout)

Determine the goal of solving it

Input

Determine the items needed to achieve that goal

Pseudo-code

tool programmers use to help plan an algorithm Not understandable by a compute

Processing item

an intermediate value (neither input nor output) the algorithm uses to transform input into output

Desk checking

verifies that that the algorithm is correct

Valid data

data that the algorithm is expecting the user to enter

Invalid data

data that the algorithm is not expecting the user to enter

camel case

If variables contain more than one word, capitalize the first letter of each word after the first

Syntax

for declaring a named constant in C++ -const dataType constantName = value;
const keyword indicates that the memory location is a named constant (value cannot be changed during runtime)

A stream

A stream
is a sequence of characters

The extraction operator (>>)

takes information out of cin object and stores it in internal memory (variable) - Syntax: cin >> variableName;

Syntax errors

result from breaking programming language's rules; cause compiler errors

Logic errors

don't cause compiler errors; can be hard to identify

A #include directive

allows you to merge the source code in one file with that in another file

Most common operators

are += , -= , *= , /= , and %=

Using directive tells the compiler

where in internal memory it can find definitions of C++ keywords and classes like double or string

if (condition)

one or more statements (true path)

else one or more statements

false path

statement block

if path contains more than one statement, must be entered as a (enclosed in {})

Comparison operators

are used to compare two
values that have the same data type
- less than (<)
- less than or equal to (<=)
- greater than (>)
- greater than or equal to (>=)
- equal to (==)
- not equal to (!=)
� No spaces between dual-character symbols

Logical operators

allow you to combine two or more conditions (sub-conditions) into one compound condition

toupper function

temporarily converts a character to uppercase;

tolower function

temporarily converts a character to lowercase

setprecision stream manipulator

controls number of decimal places
- If setprecision is used after fixed then setprecision specifies the number of digits after the decimal place.
- If setprecision is used by itself then setprecision specifies the total number of digits in the number.

Program must contain

#include <iomanip> directive to use setprecision manipulato

nested selection structures

Inner selection structures ; contained (nested) within an outer selection structure

Three common logic errors made when writing selection structures

- Using a compound condition rather than a nested selection structure
- Reversing the outer and nested decisions
- Using an unnecessary nested selection structure

statement to code

Can sometimes use the switch statement to code a multiple-alternative selection structure
Must result in a data type that is bool, char, short, int, or long
� Between opening and closing braces (after selector expression), there are one or more case claus

break statement

tells computer to break out of switch at that point; must be the last statement of
a case clause

Coding

is the process of translating a computer solution into a language a computer can understand

machine language or machine code

Instructions written in 0s and 1s

The sequence structure

directs the computer to process the program instructions, one after another, in the order listed in the program

An algorithm

is a set of step-by-step instructions that accomplish a task

Selection structure

makes a decision and then takes an appropriate action based on that decision Also called the decision structure

Repetition structure

directs computer to repeat one or more instructions until some condition is met - Also called a loop or iteration

Output
(cout)

Determine the goal of solving it

Input

Determine the items needed to achieve that goal

Pseudo-code

tool programmers use to help plan an algorithm Not understandable by a compute

Processing item

an intermediate value (neither input nor output) the algorithm uses to transform input into output

Desk checking

verifies that that the algorithm is correct

Valid data

data that the algorithm is expecting the user to enter

Invalid data

data that the algorithm is not expecting the user to enter

camel case

If variables contain more than one word, capitalize the first letter of each word after the first

Syntax

for declaring a named constant in C++ -const dataType constantName = value;
const keyword indicates that the memory location is a named constant (value cannot be changed during runtime)

A stream

A stream
is a sequence of characters

The extraction operator (>>)

takes information out of cin object and stores it in internal memory (variable) - Syntax: cin >> variableName;

Syntax errors

result from breaking programming language's rules; cause compiler errors

Logic errors

don't cause compiler errors; can be hard to identify

A #include directive

allows you to merge the source code in one file with that in another file

Most common operators

are += , -= , *= , /= , and %=

Using directive tells the compiler

where in internal memory it can find definitions of C++ keywords and classes like double or string

if (condition)

one or more statements (true path)

else one or more statements

false path

statement block

if path contains more than one statement, must be entered as a (enclosed in {})

Comparison operators

are used to compare two
values that have the same data type
- less than (<)
- less than or equal to (<=)
- greater than (>)
- greater than or equal to (>=)
- equal to (==)
- not equal to (!=)
� No spaces between dual-character symbols

Logical operators

allow you to combine two or more conditions (sub-conditions) into one compound condition

toupper function

temporarily converts a character to uppercase;

tolower function

temporarily converts a character to lowercase

setprecision stream manipulator

controls number of decimal places
- If setprecision is used after fixed then setprecision specifies the number of digits after the decimal place.
- If setprecision is used by itself then setprecision specifies the total number of digits in the number.

Program must contain

#include <iomanip> directive to use setprecision manipulato

nested selection structures

Inner selection structures ; contained (nested) within an outer selection structure

Three common logic errors made when writing selection structures

#NAME?

statement to code

Can sometimes use the switch statement to code a multiple-alternative selection structure
Must result in a data type that is bool, char, short, int, or long
� Between opening and closing braces (after selector expression), there are one or more case claus

break statement

tells computer to break out of switch at that point; must be the last statement of
a case clause