Table of Contents
PPT Slide
Some Forms of Abstraction in Programming
Implementation of Data Type Requires
Control Abstraction
Control Structures for
Choosing Looping Structures
Functional Abstraction
Parts of Function Definition
What is a prototype?
Parameters classified by location
Some C++ Texts
C and C++ Major Differences
C and C++ More Differences
C and C++ More Differences
PPT Slide
PPT Slide
By default, parameters (of simple types like int, char, float, double) are always value parameters, unless you do something to change that. To get a reference parameter you need to place & after the type in the function heading and prototype.
When to use reference parameters?
PPT Slide
PPT Slide
Pass-by-reference is also called . . .
Pass-by-value
Pass-by-reference
Pass-by-reference
Parameters classified by purpose
For all data types EXCEPT arrays--
For arrays--
Example of Pass-by-Reference
PPT Slide
void GetRoots( float a, float b, float c, float& Root1, float& Root2 ){ float temp; temp = b * b - 4.0 * a * c; Root1 = (-b + sqrt(temp) ) / ( 2.0 * a ); Root2 = (-b - sqrt(temp) ) / ( 2.0 * a ); return;}
PPT Slide
Capitalization conventions used
Function naming conventions used
Six-part Problem Specification
Top-down Testing with Function Stubs
Bottom-up Testing
An Assertion
Some Assertions
A Precondition and Postcondition
Preconditions and Postconditions
PPT Slide
PPT Slide
Loop Invariant is an assertion
While Loop Invariant
Examples of Loop Invariants
Where to place the loop invariant?
While Loop Invariant
For Loop Invariant
Do-While Loop Invariant
|
Author: Sylvia Sorkin
Email: ssorkin@essex.cc.md.us
Home Page: http://www.essex.cc.md.us/Essex/People/ssorkin/index.html
Download presentation source
|