Characters must also be encoded in binary. ASCII maps characters to numbers.

Slides:



Advertisements
Similar presentations
Functional Programming Lecture 15 - Case Study: Huffman Codes.
Advertisements

For(int i = 1; i
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Lecture 9: Character and String
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
1 DATA ABSTRACTION: USER DEFINED TYPES AND THE CLASS.
1 Lecture 7  Fundamental data types in C  Data type conversion:  Automatic  Casting  Character processing  getchar()  putchar()  Macros on ctype.h.
Lecture 10 ctype.h, Exercises METU Dept. of Computer Eng. Summer 2002 Ceng230 - Section 01 Introduction To C Programming by Ahmet Sacan Wed July 31, 2002.
Strings and Number Conversions Chapter 12. Strings and Number Conversions WHYP Strings ASCII Number String to Binary Conversion Binary Number to ASCII.
Introduction to Computers and Programming Lecture 7:
Scope and Casting. Scope Region of the program where a particular name can be referenced Formal parameters and local variables –can be accessed from within.
1 Review of Class on Oct Outline of Chapter 4  How to write a function?  Function Prototypes  Function Invocation  Function Definition  The.
Topic 6A – The char Data Type. CISC 105 – Topic 6A Characters are Numbers The char data type is really just a small (8 bit) number. As such, each symbol.
Working with the data type: char  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
1 Agenda Variables (Review) Example Input / Output Arithmetic Operations Casting Char as a Number (if time allow)
ASCII & Gray Codes.
CIS 234: Character Codes Dr. Ralph D. Westfall April, 2011.
Programming Variables. Named area in the computer memory, intended to contain values of a certain kind (integers, real numbers, characters etc.) They.
Lab 5 Part C Write to the screen a character string that uses a ‘$’ to indicate the end of the string. Do not write the ‘$’ to the screen. Use DOS Interrupt.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
The char Data Type A char is a one byte integer type typically used for storing characters. Example: char oneLetter = ’D’; We enclose the character in.
Binary, Decimal and Hexadecimal Numbers Svetlin Nakov Telerik Corporation
STANDARD FUNCTIONS Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
CISC105 – General Computer Science Class 9 – 07/03/2006.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
CS177 Week2: Recitation Primitive data types and Strings with code examples.
Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab- program number at the top of the program as a.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
Characters and Strings. Characters  New primitive char  char letter; letter = ‘a’; char letter2 = ‘C’;  Because computers can only represent numbers,
PROCESSING Types. Objectives Be able to convert between binary and decimal numbers. Be able to declare and initialize character variables and constants.
Solution to Midterm Exam
Character Encoding & Handling doubles Pepper. Character encoding schemes EBCDIC – older with jumps in alphabet ASCII 1967 (7 bit)– Handled English, –ASCII.
Hashing Suppose we want to search for a data item in a huge data record tables How long will it take? – It depends on the data structure – (unsorted) linked.
Agenda Character representation Numerical Conversions ASCII EBCDIC
Road map char data type Reading –Liang 5: Chapter 2: 2.7.4; 2.9; –Liang 6: Chapter 2: 2.7.4; 2.9 –Liang 7: Chapter 2: 2.7.4; 2.9.
CSC Programming for Science Lecture 8: Character Functions.
More than just a song and dance.. They are objects that store primitive variable values: Integer – stores an int Double – stores a double Character –
Characters and Strings
Review (before the 1 st test): while (conditions) { statements; } while loop: if/else if/else statements: if (conditions) { statements; } else if (different.
Jordan Jozwiak CS50. Announcements Pset3 will be returned by 7pm on Tuesday REMINDER: Access section materials from this year and last year at
Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
ABCDEF 00 NULSOHSTXETXEOTENQACKBELBSHTLFVTFFCRSOSI 10 DLEDC1DC2DC3DC4NAKSYNETBCANEMSUBESCFSGSRSUS 20SP!"#$%&'()*+,-./ :;?
More String Manipulation. Programming Challenge Define a function that accepts two arguments: a string literal and a single character. Have the function.
Concatenation + Tack new stuff onto the end/right-hand side of a string “New stuff” can be: Char variable String variable Char literal String literal.
 Type Called bool  Bool has only two possible values: True and False.
1.4 Representation of data in computer systems Character.
BINARY CODE.
Lecture 8 String 1. Concept of strings String and pointers
Agenda Warmup Finish 2.4 Assignments
# of Bits is powers of 2 - not conversions
Data Encoding Characters.
Hire Toyota Innova in Delhi for Outstation Tour
Loops The loop blocks you've used in Scratch can all be recreated in C! Loops allow for the repetition of code until a condition is met. There are three.
Loops The loop blocks you've used in Scratch can all be recreated in C! Loops allow for the repetition of code until a condition is met. There are three.
Loops The loop blocks you've used in Scratch can all be recreated in C! Loops allow for the repetition of code until a condition is met. There are three.
Unit-2 Objects and Classes
String Encodings and Penny Math
functions: argument, return value
String Methods.
Summary CSE 2031 Fall May 2019.
String Encodings and Penny Math
AP Java Unit 3 Strings & Arrays.
C Programming Language
EECE.2160 ECE Application Programming
BETONLINEBETONLINE A·+A·+
C Characters and Strings
CSCE 206 Lab Structured Programming in C
Boolean in C++ CSCE 121.
Presentation transcript:

Characters must also be encoded in binary

ASCII maps characters to numbers

AAS ASCII Math What will print? 1. printf("%d\n", 'a' – 'A'); 2. printf("%c\n", 'B' + ('a' – 'A')); 3. printf("%c\n", 'b' – ('a' – 'A')); 4. printf("%c\n", 'B' + 1); 5. printf("%c\n", ('z' – 'a' + 1) % 26 + 'a');

AAS Example #1 Prints Z through A 1. for (int i = 'Z'; i >= 'A'; i--) printf("%c\n", i);

AAS Example #2 Converts a lowercase string to uppercase 1. char name[] = "milo"; 2. for (int i = 0, j = strlen(name); i < j; i++) name[i] = name[i] + ('A' - 'a'); 1. f