Chap 1 CPP 3 RD
Chap 1 CPP 3 RD
Chap 1 CPP 3 RD
C++ Basics
• C++ Terminology
– Programs and functions
– Basic Input/Output (I/O) with cin and cout
• Variables
– A memory location to store data for a program
– Must declare all data before use in program
• Display, page 14
• Post-Increment
intVar++
– Uses current value of variable, THEN increments it
• Pre-Increment
++intVar
– Increments variable first, THEN uses new value
• "Use" is defined as whatever "context"
variable is currently in
• No difference if "alone" in statement:
intVar++; and ++intVar; identical result
• Identifier naming
– ALL_CAPS for constants
– lowerToUpper for variables
– Most important: MEANINGFUL NAMES!