• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

image

PLAY BUTTON

image

PLAY BUTTON

image

Progress

1/107

Click to flip

107 Cards in this Set

  • Front
  • Back
= symbol
Assignment operator. Takes the value of expression on the right and stores it in the variable whose name appears on the left.
Algorithm
set of well defined steps for performing a task or solving a problem - sequentially ordered
C++
Based on C language; invented for purposes of writing OS & compilers. Carries all low level capabilities from C with it. Portable. Popular because of mixture of high level/low level language and portability.
CPU - Central Processing Unit
Actually runs the programs. Job is to fetch instructions, follow instructions and produce some result. Consists of 2 parts: Control Unit, Arithmetic & Logic Unit
Control Unit
Coordinates all of the computer's operations
Fetch/Decode/Execute = Control Unit Cycle
Design Tools
1) Hierarchy Chart: Diagram that graphically depicts the "structure" of program
2) Flowchart: diagram that shows the logical flow of a program.
3) Pseudocode: cross between human language and computer language.
Desk Checking
The programmer starts reading the program - or a portion of the program - and steps through each statement
Disk Drive
Stores data by magnetically encoding it onto a circular disk.
Executable File
File containing machine instructions (executable code) and is ready to run on machine.
Fetch/Decode/Execute Cycle
Cycle completed by the CPU's Control Unit.
Fetch: Fetch's from main memory, the next instruction in the sequence of program instructions.
Decode: The instructions are encoded n the form of a number. The control unit decodes the instruction and generates an electronic signal.
Execute: The signal is routed to the appropriate component of the computer (ALU, Disc Drive, or some other device). The signal causes the component to perform an operation.
Hardware
1. CPU
2. RAM
3. Secondary Storage Devices (HD)
4. Input Devices
5. Output Devices
High Level Language
Closer to the level of human readability than machine or computer readability.
IDE - Integrated Development Environment
Consists of a text editor, compiler, debugger and other utilities, integrated into a package with a single set of menus.
Keywords
Words that have special meaning, can only be used for their intended purpose. (Also known as reserve words)
Logical Errors
Mistakes that will cause the program to produce erroneous results.
Low Level Language
Close to the level of the computer, resembles the machine language.
Object Code
Machine Language instructions translated by the compiler.
Object Oriented Programming
A programming element that contains data and the procedure that operates on the data. "Self Contained Unit".
Objects: contain the information and the ability to manipulate the information.
Operand
Usually a "piece" of data - like a number.
Operators
Perform operations on one or more operands.
Operating System
Most fundamental set of programs, controls the internal operations of computer's hardware, manages all the devices connected to computer, allows data to be saved and retrieved; and allows other programs to run.
Portability
Can be written on one machine and then transferred to others.
Primary Program Activities
Input (cin = see input)
Processing (perform operations)
Output (cout - see output)
Procedural Programming
Programmer constructs procedures or functions
Procedures
Collections of programming statements that perform a specific task.
Program
Set of instructions a computer follows to perform a task. (software)
Programmer Defined Identifiers
Words/Names identified by programmers - symbolic names that refer to variables or programming routines.
Programmer/Software Developer
Person with the training/skills necessary to design, create and test computer programs.
Programming Language
Uses words instead of numbers (binary code), invented to ease the tassk of programming. Converted into computer language by special software.
Programming Process
1. Clearly define what program will do.
2. Visualize the program running
3. Use Design tools
4. Check the model for logical errors.
5. Type the code, save it compile it.
6. Correct any errors. (repeat steps 5 & 6 as necessary)
7. Run Program, test data.
8. Correct any errors found while running - repeat steps 5 & 6 as necessary
9. Validate the results.
= symbol
Assignment operator. Takes the value of expression on the right and stores it in the variable whose name appears on the left.
Algorithm
set of well defined steps for performing a task or solving a problem - sequentially ordered
C++
Based on C language; invented for purposes of writing OS & compilers. Carries all low level capabilities from C with it. Portable. Popular because of mixture of high level/low level language and portability.
CPU - Central Processing Unit
Actually runs the programs. Job is to fetch instructions, follow instructions and produce some result. Consists of 2 parts: Control Unit, Arithmetic & Logic Unit
Control Unit
Coordinates all of the computer's operations
Fetch/Decode/Execute = Control Unit Cycle
Design Tools
1) Hierarchy Chart: Diagram that graphically depicts the "structure" of program
2) Flowchart: diagram that shows the logical flow of a program.
3) Pseudocode: cross between human language and computer language.
Desk Checking
The programmer starts reading the program - or a portion of the program - and steps through each statement
Disk Drive
Stores data by magnetically encoding it onto a circular disk.
Executable File
File containing machine instructions (executable code) and is ready to run on machine.
Fetch/Decode/Execute Cycle
Cycle completed by the CPU's Control Unit.
Fetch: Fetch's from main memory, the next instruction in the sequence of program instructions.
Decode: The instructions are encoded n the form of a number. The control unit decodes the instruction and generates an electronic signal.
Execute: The signal is routed to the appropriate component of the computer (ALU, Disc Drive, or some other device). The signal causes the component to perform an operation.
Punctuation
Characters, mark the beginning or ending of a statement, or separates items into a list.
Run Time Library
Collection of code - prewrittren - for performing certain common operations or sometimes, difficult tasks
Software
Sequence of instructions, stored in computer's memory
Software Development Tools
Tools that programmers use to create modify and test software; i.e., compilers, integrated development tools (IDE)
Software Engineering
Designing, writing, testing, debugging, documenting, modifying and maintaining complex software development projects (usually a team approach)
Source Code
Statements written by programmer (saved in a source file)
Statement
A complete instruction that causes the computer to perform some action. Can be a combination of keywords, operators, and programmer defined symbols.
Syntax
Rules that must be followed when constructing a program. Dictates how keywords and operators may be used; and where punctuation symbols must appear.
Syntax Errors
Illegal uses of keywords, operators, punctuation and other language elements.
System Software
OS, utility programs, software development tools.
Process of Translation
1st: Preprocessor: reads the source code. Searches for special lines that begin with # - contain commands that cause the preprocessor to modify the source code in some way.
2nd: Compiler: steps through the preprocessor source code and translates each source code instruction into the appropriate machine language - also finds syntax errors.
3rd: Linker: another program combines object file with necessary library files/routines and creates an "executable file".
Utility Programs
Performs a specialized task that enhances the computer's operations or safeguards data; i.e., backup programs, virus scans, file compression programs.
Variable
A named storage location in the computer's memory for holding a piece of information. (symbolic names that represent locations in the RAM)
Variable Definition
Used to define one or more variables that will be used in the program, and indicate the type of data they will hold. (Causes the variables to be created in memory for later use. All must be defined before use in program)
// (backslash symbols)
Marks the beginning of a comment:
* ignored by the compiler
* helps explain to code and formatting to others
# (symbol)
Preprocessor directive.
Preprocessor reads program before compiling and executes lines with #
(sets up program for compiler and executes lines with # - adds the files to the program)
iostream
file that contains code that allows a C++ program to display output on the screen and to read input from keyboard.
using namespace std;
(C++ uses namespaces to organize the names of program entities.) This statement declares that the program will be accessing entities whose names are part of the namespace "std".
Note: every name created b y iostream file is part of namespace standard.
int main ()
marks the beginning of a function.
Function
Group of one or more programming statements that collectively has a name. i.e., main ()
the parentheses following name of function indicate that its a function
int
Integer. Indicates the function sends an integer value back to the OS when it is finished executing.
*Every program Must have a function
* Function named "main" is where the program starts.
; (symbol)
marks the end of the complete statement
*comment lines and preprocessor directives do not require ;
*The beginning of a function like: int main () - also doesn't require ;
{ }
Braces - Left brace is the opening brace associated with the beginning of the function main
} marks the end of the main function
* All statements that make up a function are enclosed in braces
* Must have the right brace } (closing brace) for each function
return 0;
Sends the integer value 0 back to the OS upon program's completion
* The value 0 usually indicates the program completed successfully
endl;
manipulator, advances the program to the beginning of the next line for subsequent printing.
\n
Newline escape sequence - interpreted by computer as a special command to advance the output cursor to the next line.
* code will not compile if \n isn't enclosed in quotation marks.
Common Escape Sequences
\n - new line
\t - horizontal tab - cursor skips to next tab stop
\a - causes computer to beep (alarm)
\b - causes computer to back up one position to the left
\r - causes computer to go to beginning of current line
\\ - causes a backslash to be printed
\' - causes a single quotation mark to be printed
\" - causes a double quotation mark to be printed
Header File
i.e.. iostream
Contains information describing iostream objects. Without this, computer could not properly compile a program that uses cout
Identifier
Programmer defined name that represents some element of a program, i.e., variable names
* can not contain spaces
* can not begin with a digit (#)
Unsigned Data Type
Can only store non-negative values, i.e., ages, weights
unsigned short: 0 to 65,535
unsigned long: 0 to 47,2964,967,295
unsigned int: 0 to 4,294,967,295
Integer Types and Ranges
* integers are at least as big as short integers
* long integers are at least as big as integers
short - 2 bytes -32,768 to +32,767
unsigned short - 2 bytes 0 to 65,535
int - 4 bytes -2,147,483,648 to +2,147,4783,647
long - 4 bytes -2,147,483,648 to +2,147,483,647
unsigned long - 4 bytes 0 to 4,294,967,295
Hexadecimal
another numbering system - base 16
expressed by placing 0xF4
Octal Numbers
(base 8) must be preceded by a 0
i.e., 031
char
data type = 1 byte
Character literals are enclosed in single quotation marks.
*Can only store 1 character in its memory location.
Strings
A series of characters stored in consecutive memory locations. Can be virtually any length. Enclosed in double quotation marks.
Floating point
Data type used to determine variables that cn hold real numbers (dollar amounts, precise measures)
Allows fractional values. C++ has three types: float, double, long double
float
data type considered single precision
4 bytes
Numbers between +- 3.47E and +-3.4e38
* to force a literal to be stored as float, append letter F or f to the end: 1.2f
double
data type usually twice as big as float and considered double precision.
8 bytes
numbers between +-1.7E-308 and +-1.7E308
long double
data type, precision
8 bytes
numbers between: +-1.7E-308 and +-1.7E308
* to force number to be stored as long double, append the letter L to end: 1034.5L
boolean
variables are set to either true or false
* allows you to create small integer variables that are suitable for holding T/F values
rvalue
the operand on the right side of assignment operator. Any expression that has a value.
Initialization
Assigns values to variables as part of the definition.
*simplifies and reduces the number of statements that must be typed by programer.
Scope
(a variable's scope) the part of the program that has access to the variable - where variable may be used.
Complex Rules.
* a variable can not be used in any part of program before it is defined.
Operator Types
unary operator - requires only one operand. i.e., -5
binary operator: requires two operands - i.e., assignment operator
tertiary operand - requires 3 operands
/* mmmm */
Multiline comments - everything between /* and */ are ignored by compiler
Named Constants
like a variable, but the contents are read only - can't be changed while program is running.
i.e., const double IntRate = 0.69;
*when set as a constant and used through out program and the number changes, you only have to go to one place to update
* helps prevent typos
Programming Style
Refers to the way a programmer uses identifiers, spaces, tabs, bnlank lines, and punctuation characters to visually arrange a program's source code.
*creates visual cues dignifying importance.
Type Casting
Allows you to perform manual data type conversion
Type Cast Expression
Lets you manually promote/demote a value: static_cast<datatype>(value)
(value is a variable/literate you want to convert and data type is what you are converting to)
i.e.,
double number = 3.7;
int val;
val = static_cast <int> (number)
returns a copy of value in number, converted top an integer, fractional part is truncated. This statement stores 3 in val, original number isn't changed.
C Style Cast
Name of a data type enclosed in (), preceding the value that is to be converted.
val = (int)number
C Style Cast is: (int)
Multiple Assignment
Multiple variables being assigned same value.
a=b=c=d=12;
12 is assigned to each variable. Works right to left.
Combine Number
Works right to left.
number = number +1
The expression on right side gives the value of number +1 and the result is assigned to number, replacing previous value.
Operators:
+ = x+=5 x = x + 5
- = x-=5 x = x - 5
* = x*=10 x = x * 10
/ = a/=b a = a / b
% = c%=3 c = c % 3
Field Width
The minimum number of characters, positions or spaces on the screen to print the value in.
cout << setw(#) << value
Fixed Manipulator - setprecision
* requires iomanip header file
Set precision - floating point values may be rounded to a number of "significant digits" or "Precision" - the total number of digits that appear before and after decimal point.
Automatically rounds number to specified number of digits assigned.
cout << setprecision(5) << quotient << endl;
4.91877
cout << setprecision(4) << quotient << endl;
4.9188
Showpoint Manipulator
Will show trailing zeros (after decimal)
123.400
(if setprecision is set to 3)
cout << setprecision(3) << showpoint << x << endl;
x = 123.40000
Whitespace Characters
Spaces, tabs, linebreaks, enter key
getline
Special function for working with characters/strings that have whitespace.
getline(cin, name)
Kate Smith
(blank space doesn't throw off program)
Get Member function
Reads a single character including white space. 3 options:
cin.get(ch); (char = ch)
ch = cin.get();
cin.get();
Hand Tracing
Debugging process where you pretend you are computer executing program. Walk through step by step, recording contents of variables as you go and they change.
cin
cin - object used to read data typed at the keyboard.
Expression
Programming statement that has a value, consists of an operator and operands. i.e., sum = 21 + 3
Operator Precedence
Precedence of Arithmetic operators (highest to lowest)
unary negation -
* / % { same precedence
+ - {same precedence
works left to right unless ( ) are used.
Arguments
Data being sent to the function (numbers inside the ( ). )
pow
library function, purpose is to raise a number to a power:
area = pow(4.0, 2.0)
raises 4 to the second power. Always raises first argument to the power of the second argument.
Rules:
1. Program must include cmath header file
2. Argument you pass to the pow function should be defined as double
3. Variable used to store pow should be defined as double.
Rank of Data Types
(Highest to Lowest)
Long Double
Double
float
unsigned long
long
unsigned int
int
* one exception: when an int and a long are the same size, an unsigned in outranks long because it can hold a higher value.
Type Coercion
C++ working with an operator, strives to convert operands to same type.
Specific Rules:
1. Chars, shorts and unsigned shorts are automatically promoted to int
2. When an operator works with two values of different data types, lower ranking value is promoted
3. When the final value of an expression is assigned to variable, it will be converted to the data type of that variable (defined)
% (Modulus)
Works only with integer operands and returns the remainder of an integer division.
i.e.,
leftover = 17 % 3 - assigns 2 to variable leftover.
means: 17 / 3 = 5, 2 remaining