70 likes | 175 Views
Characters vs. Numbers. Basic Data Types. Adding in Binary : There are only four (4) possible combinations :. 0 + 0 0. 0 + 1 1. 1 + 0 1. 1 + 1 10.
E N D
Characters vs. Numbers Basic Data Types Adding in Binary: There are only four (4) possible combinations: 0 + 0 0 0 + 1 1 1 + 0 1 1 + 1 10 Remember: Since binary contains the only the digits 0 & 1, the number 2 must be represented using 2 digits (10) Similarly, in Decimal, there is no symbol for ten, so we must use two symbols: 1 and 0 (10).
1 0 1 + 1 0 1 1 1 1 1 1 1 1 + 1 0 1 0 0 1 1 1 1 + 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 + 1 0 0 1 1 0 + 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 0 Some additional Examples of adding in Binary: Basic Data Types
From the ASCII Tables, we know: Basic Data Types 0110011 is the sequence of bits needed to represent ‘3’ 0110100 is the sequence of bits needed to represent ‘4’ Therefore: 0110011 + 0110100 1100111 Must be the sequence of bits needed to represent ‘7’ According to the ASCII Tables 1100111 is the sequence of bits needed to represent the character ‘g’. What Gives??
Yielding: ASCII is a coding to scheme used to represent ONLY CHARACTERS AND/OR SYMBOLS. Basic Data Types The character ‘3’ is no more a number than it is in the string “TJF-3H9” (License Plate Number??). Trying to add the characters ‘3’ and ‘4’ makes no more sense than trying to add the strings : How Now Brown Cow? + To be or not to be. Good Golly, Miss Molly
Does that mean the computer really doesn’t work with numbers, only symbols?? Basic Data Types NO - The computer works ONLY with numeric values: The character ‘3’ is actually the numeric value: 51 The character ‘4’ is actually the numeric value: 52 The character ‘g’ is actually the numeric value: 103 Check your ASCII Tables
Why are there differences?? Why isn’t the character ‘3’ stored the same way as the number 3??? Basic Data Types In order to draw the distinction between Numbers and Characters. How would the numbers 3 and 4 be stored? Basically, in the same manner in which we stored them when we first started talking about bits.
This Concludes The Slides for this Section Choose an Option: Repeat Slides for this Section Go To Next Set of Slides For this Chapter Go To Slide Index For Chapter 2 Go To Slide Index For Chapter 3 Go To Slide Index For Textbook Go To Home Page