70 likes | 308 Views
Data Types. Basic data types: Text Numeric Numeric data stored by numeric variables Text data stored by string, text, or character variables – surrounded by “ “ (ie. “color”). Types of Data. Numeric Data Integer data (whole numbers) 10 25 -45 0
E N D
Data Types • Basic data types: • Text • Numeric • Numeric data • stored by numeric variables • Text data • stored by string, text, or character variables – • surrounded by “ “ (ie. “color”)
Types of Data • Numeric Data • Integer data (whole numbers) • 10 25 -45 0 • Real (Floating point) data (numbers that have a decimal point) • 23.5 -5.0 • Note: 5 and 5.0 are stored differently in a computer even though they have the same value. The first, 5 is an Integer but the second, 5.0 is a Real number. • Character data (alphanumerics) • All the characters you can type at the keyboard • The type is String or Character
Numeric data types: • Integer: whole numbers only • Floating-point: fractional numeric values with decimal points
Numeric Data • Integer data (whole numbers) • 10 25 -45 0 • Real (Floating point) data (numbers that have a decimal point) • 23.5 -5.0 • Note: 5 and 5.0 are stored differently in a computer even though they have the same value. The first, 5 is an Integer but the second, 5.0 is a Real number. • Character data (alphanumerics) • All the characters you can type at the keyboard • The type is String or Character
Concatenation • Concatenation takes two strings and joins them to create a string result • The concatenation operator is symbolized, in pseudocode, with a + sign • Example: if: • String1 = “yellow” and String2 = “duckie” • then the statement: • Set MyFriend = String1 + String2 • results in: • MyFriend = “yellow duckie”