This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 4002208Intro. to Prog. [in C++]Day 03Assignment Statement & Data TypesObjectives•Numeric data types•Assignment Statement•Type conversions4002208Page 2Data Types•Integer (counting)–char1 byte128 to +127–short 2 bytes 32,768 to +32,767–int4 bytes+/ 2 x 109•Examples–int age;–int age, numEmp;–int age = 0; //declare age with initial value of 0•Most commonly used types are in bold.Page 34002208Double Data Types•Floating Point (calculator numbers)–float4 bytes7 digits and 10+/38–double8 bytes15 digits and 10+/308•Examples–double weight = 3.4;–double side1 = 0.0, side2 = 1.0, side3 = 2.3;Page 44002208Numeric Literal•A number such as 7 or 3.14159 used in an arithmetic expression.•The literal must be stored in memory•How is the data type determined?•If a decimal point is present, then double otherwise int.•int: 7 +7 7•double: 7.2 7. 7.0 6.023e234002208Page 5Assignment Statement  Basics•variable = expression;•The symbol “=“ is not algebraic equality.•First, the value of the expression is calculated.•Second, the value of the expression is assigned to the variable on the left of the assignment sign....
View
Full
Document
This note was uploaded on 03/31/2009 for the course NSSA 4002 208 taught by Professor Niemi during the Spring '09 term at RIT.
 Spring '09
 Niemi

Click to edit the document details