CPS 6, Ramm - Spring 2000 - 1/19/00 #3
- Announce
- Roll (last)
- Lab #1 (under way)
- Assignment #1
- Quiz on Friday
Chapter 2: C++ Programs: Form and Function
- Functions with Parameters
Flexibility/Versatility
page.cpp
- Functions with several parameters
announce.cpp
Order of Parameters
- Functions Invoking Functions
diamond2.cpp
- Order of Functions
mondias.cpp
- Function Prototypes - Syntax
return-type
function(type name, type name, ...);
return-type
function(type, type, ...);
===>>> ;
- Using Function Prototypes
diamondsp.cpp
- Let's Write a Program (class activity)
Requirements:
- Use functions
- Have functions use functions
- Minimize repetition
- Some kind of "graphic" output
Questions:
- Do we need prototype statements?
- What language features could we use?
- More on Style
- Indenting
- Braces on separate lines
- Good Identifiers
- Identifiers/Syntax
- letters, digits, underscore
- do not start with digit
- case sensitive
- arbitrary length
- do not use reserved words
- Identifiers/Style
- meaningful identifiers
- user defined functions & types start: uppercase
- parameters or variables start: lowercase
- constants (later): all uppercase
- use uppercase to start multi-part words (not _)