208 Day 03 Assgn&Data types

208 Day 03 Assgn&Data types - 4002-208Intro. to Prog....

Info iconThis preview shows pages 1–7. 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

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: 4002-208Intro. to Prog. [in C++]Day 03Assignment Statement & Data TypesObjectives•Numeric data types•Assignment Statement•Type conversions4002-208Page 2Data Types•Integer (counting)–char1 byte-128 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 34002-208Double 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 44002-208Numeric 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.023e-234002-208Page 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.

Page1 / 22

208 Day 03 Assgn&Data types - 4002-208Intro. to Prog....

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

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