| Terms |
Definitions |
|
logical gates
|
variable that holds character values
|
|
loop break/continue/return
|
break: used to break out of the loop and go to the next statement (within nested loop, will break out of inner loop and continue through rest of outer loop)continue: skips rest of statements in loop, increments, then goes to the next pass of the loopreturn: will break out of the entire function (same as break, but it will return some value-t,f,void, or value)
|
|
operation scenarioprogrammer set*float =
|
float
|
|
operation scenarioint/int =
|
int
|
|
logical gates
|
variable that holds character values
|
|
boolean
|
value that can be ONLY true(1) or false (2)
|
|
key features of method to identify
|
return type - ie void etc.local variables - defined inside or outside method?returning a value - if void, none, if not void, must return value
|
|
operation scenariodouble*int =
|
double
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
loop initialization
|
variable is sole controller of when loop is started and stopped.variable can be a number that will need to change from a starting value, to an ending value, usually the start and ending values are big enough
|
|
logical gates
|
variable that holds character values
|
|
operation scenariofloat/float =
|
float
|
|
logical gates
|
variable that holds character values
|
|
numeric variable
|
variable that holds a number
|
|
logical gates
|
variable that holds character values
|
|
operation scenarioint*double =
|
double
|
|
logical gates
|
variable that holds character values
|
|
binary increments
|
128, 64, 32, 16, 8, 4, 2, 1
|
|
logical gates
|
variable that holds character values
|
|
while loops
|
used extensively in reading data from a file.make sure { }'s are in block line structureinitialize variable BEFORE the loopinitializing variable is SET so that the loop will runused when NOT exatly sure when the loop should or will end, or when the USER will define when to end
|
|
methods within classes
|
variable that holds character values
|
|
simple method calling
|
to call a method, it must be called from another method.e.g.void main(){hello x=new Hello(); x.greeting}public void greeting(){cout<< "Hi, my name is Mr. Lupoli"<<endl;}parameters were needed so () was left empty. all that was needed to call method was method name and ()s. any method can call any other method.
|
|
parameters
|
indicate what is needed for specific method to run. if (), there are no parameters. used when you need to pass if you wish to, change more than one value/variable, pass in variables that are needed to run a program
|
|
logical gates
|
variables, conditionsor-ll(if x is true, or y is true, answer is true)x=0,y=0;answer=falsex=1,y=1;answer=truesame process with and-&&, not-!, equal-==order of operations is !; ==/!==; ll
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
incrementing/decrementing
|
++x changes value before modification/loop in code completed.x++ changes value (adds 1)after modification/loop in code completed--x, x-- (same as above process but subtracts 1instead)
|
|
pseudocode
|
an english-like representation of the logical steps it takes to solve a problem
|
|
member access specifier: public, protceted, private
|
Public: methods/prototypes and variables that can be accessed by the source and the main (can be changed by end user)Protected: access member via ONLY the subclass class methodsPrivate: methods/prototypes and variables that can not be accessed by the main, but can be accessed by the source (program - eg. tests scores can be entered by end user. average is worked out and displayed by the computer, not entered by user.)NEITHER CAN BE INITIALIZED, whatever the fuck that means
|
|
simple void method with parameters
|
int Ravens=0, Steelers=14temp_swap(Ravens, Steelers);void temp_swap(int a, int b){int temp = a;//a=0, b=14b= a;b= temp;cout <<a<<"-"<<b<< endl; //result is a=14, b=0, displays as Ravens 14, Steelers 0.in this example, int a is the ALIAS for Ravens, int b is the ALIAS for Steelers. when commanded to swap, the method switches aliases, keeps the inputed scores.
|
|
string constant
|
one or more characters enclosed within quotation marks. e.g. lastname="Lincoln" - last name will be 'Lincoln' throughout methodsynonymous with 'character constant'
|
|
logical gates
|
variable that holds character values
|
|
loop - steps
|
initialization, testing/condition, incrementing
|
|
loop break e.g.
|
void main (){for(int i=0; i<10; i++){if (i>3)&&(i<7)){cout << "Greater than 3"<< endl; continue; }if(i<5){cout<<"Less than 5"<<endl; }if(i>6){cout<< "See ya"; break;}}
|
|
modulus operation
|
operation where variables are divided, answer is the remainder.12/7= 1 w/remainder of 5. answer is 5
|
|
if/else statements
|
when "if" conditions are met, process will run. if not, and it meets "else" statement, that process will run. if there's no "else" statement when "if" condition is not met, program will not run, there will be an error message.if(condition){statement; } //if one line statementif (condition){statement1;statement2;} //if multiple lined statementELSEif (condition){statement;}else{statement2;}e.g.else//then passedif(score>90){ cout <<"teacher's pet!!!"<<endl;}else{ cout<<"You Passed"<<endl; }
|
|
logical gates
|
variable that holds character values
|
|
=
|
variable assignment symbol e.g. calculatedAnswer=inputNumber*2
|
|
for loop
|
puts all three parts (initialization, testing, incrementing) in one line statements inside { }'s are in block like structure;used when you know EXACTLYwhen the loop should end, or how many times the loop should be run before it endsNONE of the three stages HAVE to be set, in order to work-you could have a totally empty for loop. that's unusual though. when condition is no longer met, loop ends.e.g. void main(){int i; /*repeat 10 times*/for (i=0; i <10; i++{cout<< "I will not chew gum in class."<< endl; }}
|
|
float variable
|
a real number in a floating point representatione.g. float GPA=3.99
|
|
methods in theory
|
procedure to complete a task, no matter how large or small; should be in small pieces for many reasons; sequential-compiler will read top to bottom so variables must be declared at the beginning of the method for later use. first line of any method is called a "method header"
|
|
logical gates
|
variable that holds character values
|
|
nested if/else statement(s)
|
if/else statement(s) within if/else statments. after branching off, statements do not interactyou want to make as many branches as possible to narrow down conditions. e.g.if (condition 1) -->(if) -->(else)elseif(condition 2) if(condition2)-->(if)-->(if) -->(else) -->(else)-->(if) -->(else)else if(condition3) - ad infinitum
|
|
logical gates
|
variable that holds character values
|
|
operation scenarioint*float =
|
float
|
|
order of operations
|
Precedence, Exponents, Multiplication, Division, Addition, Subtraction.
|
|
logical gates
|
variable that holds character values
|
|
flowchart shapes
|
input output/parallelogramprocessing/rectanglestart stop (terminal)/lozengedecision/diamondconnector/inverse trianglemethod or pre-defined process/rectangle with marginsnote-ann./bent rectangle
|
|
unknown variable tables
|
used when designing a project with many possible conditions to make sure all (im)possible conditions are covered. helpful for error checking.e.g. if ((grade teamallowed))
|
|
return statement within if statements
|
return will break out of function, will end program, but may return some value (t,f,void, or a value)
|
|
named constant
|
memory location whose contents do not vary during execution of program
|
|
return statement
|
marks the end of every method
|
|
loop
|
iterative statements (repeated steps)
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
relational operators
|
,=,==,!
|
|
operation scenarioint/float =
|
int
|
|
logical gates
|
variable that holds character values
|
|
operation scenariofloat/int =
|
float
|
|
!, ++x,--x, *, /, %, +, -, , >=, ==, !==, &&, II, x++, x--
|
in order of highest to lowest priority: not; increment, decrement, multiplication, division, modulus, addition, subtraction, less than, less than or equal to, greater than, greater than or equal to, identical-used to compare if equal, not identical-used to compare if not equal, and, or, increment after operation, decrement after operation
|
|
logical gates
|
variable that holds character values
|
|
flowchart
|
A pictorial representation of the logical steps it takes to solve a problem
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
operation scenariofloat *int =
|
float
|
|
inheritance theory"is-a(n)" relationship
|
needed when multiple classes are very similar in nature. structure is Super Class & Sub Classes that share common variables with eachother. e.g.Super Class - EmployeeSub Class - Full Time ProffSub Class - Part Time Proffname, ssn, d.o.b., address fields will be the same, though each subclass will have unique fields in addition to common fields
|
|
logical gates
|
variable that holds character values
|
|
operation scenarioint*int =
|
int
|
|
assignment statements
|
statements that assign value to variables
|
|
logical expression
|
used for certain conditions, can be exact, or wide ranging, computer will match up conditions you create, wathch for conditions that are alike, prepare fo ANY possible condition, even if you think it's impossible. type of coding: if/else; if/else-if's; logical symbols used to compare
|
|
static variable
|
variable that is GLOBALe.g. static int global_counter
|
|
integer variable
|
numeric variable holding whole numbers ranging from -2147483647 to 2147483647
|
|
while loop (counter)
|
//initializationint count=0while (coun<10)//condition{statements; ......count ++; //incrementation}
|
|
logical gates
|
variable that holds character values
|
|
scope of variables-global/local
|
global variables can be accessed throughout the entire programlocal variables begin and finish within the method it was created and can only be accessed by that method
|
|
reason for using methods
|
reusability. one method can be called many times throughout program to take care of several matrices.
|
|
method
|
a set of statements that performs some task or group of tasks.
|
|
string variable
|
variable that holds character values
|
|
while loop (non-counter)
|
//initializationchar answer='N';while (answer !='Q')//condition{statements;......cout <<Press Q to Quit<< endl; cin>>answer;}
|
|
logical gates
|
variable that holds character values
|
|
logical gates
|
variable that holds character values
|
|
polymorphism
|
a single name can have multiple meanings in the context of inheritance. it allows coder to set up method of the same name can call appropriate method in respective classes. e.g. "endOfMonthFees" can be applied to checking account info and savings account info using same method in different classes, using some common variables
|
|
operation scenariofloat/float =
|
float
|
|
variables
|
location in computer memory (ram). contents can vary or differ over time. mostly hold attributes of object. name must be one word-no spaces and can not begin with a number-only letter
|
|
loop testing/condition
|
must have condition in any loop or variable and loop will fail and the world will end.conditions in loop are the same as in if statements
|
|
int method e.g.
|
global_____________int zipcode(){........int zip=21118; //put in your zip code return zip;}no parentheses because this is not a function but a variable!!! zipcode() acts like a value, since it returns an int value
|
|
2 data types
|
text, numericcan be variable or constant
|
|
class
|
a category of things. it defines the characteristics of its objects and the methods that can be applied to its objects
|
|
logical gates
|
variable that holds character values
|
|
void main ()
|
function will not return a value
|
|
logical gates
|
variable that holds character values
|
|
operation scenarioprogrammer set/float =
|
float
|
|
logical gates
|
variable that holds character values
|
|
char variable
|
ONE character-letter, or small INTEGER in the range from -128 to 127often used for yes/no
|
|
function
|
short cut consisting of pre-defined steps bundled under 1 name or designation. you can reference throughout program (calling function) and all instructions in function will run. imagining 3 blocks stacked upon eachother, the top is for global variables, the middle for the main, the bottom contains the function(s). mechanically, the program starts at the main and follows instructions until coming upon pre-defined instruction to call a function. the program then skips down to the function instructions (bottom block), follows the instructions of the function and upon completion, returns to main(middle block) and to continue where it left off.
|
|
identifier
|
name of programming object.may only be one word-no spaces. should use appropriately descriptive name.
|
|
logical gates
|
variable that holds character values
|
|
importance of initialization's position - inside loop/outside loop
|
initialization variable declared inside loop is only applied while loop is runningif declared outside loop, variable retains declared value even after loop ends.
|
|
logical gates
|
variable that holds character values
|
|
main() method
|
name of method when class contains only one method
|
|
operation scenarioprogrammer set/int =
|
int
|