lect03 Constants and Expressions.ppt

lect03 Constants and Expressions.ppt - Todays Challenge...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Todays Challenge Imagine you are in a room with 3 switches. In an adjacent room there are 3 bulbs (all are off at the moment), each switch belongs to one bulb. It is impossible to see from one room to another. How can you find out which switch belongs to which bulb, if you may enter the room with the bulbs only once? Can Use Letters: Remember That C++ is Case Sensitive (e.g., NumWidgets Is Not the Same as numwidgets ) Can Use Digits 0-9, and Underscore Cannot Start with a Digit Cannot Contain Spaces or Other Characters Typically Maximum of 32 Characters Cannot Use C++ Keywords Naming Variables in C++: Identifiers Should Use a Meaningful, Descriptive Name so that Variables Use Is Easily Understood: Examples: counter, second, minute, length, width Be Consistent with Case; Usually Lower Case with Upper Case for Second Part of Variable Name Examples: averageRainfall, totalStudentGrades, maxBuildingHeight, minPackageWeight; Naming Variables (Cont) Scope : Area of a Program within which a Variable Can Be Referenced Variable Definitions Are Recognized in the Curly Braces in which They Were Defined Variables Declared Outside of Functions Are Recognized from the Point Declaration through the Rest of the Program Variable Scope...
View Full Document

This document was uploaded on 03/03/2010.

Page1 / 20

lect03 Constants and Expressions.ppt - Todays Challenge...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online