tailieunhanh - Lecture Introduction to Computer Programming - Lecture 21

This section addresses the question of program correctness functional programming. We visit the question of how to prove a program conect for the special case when it is written in a pure functional program-one that is state-less and relies instead on functional composition and recursion as a foundation for its semantics. | CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 21 Thanks for Lecture Slides: Principles of Programming - NI2005 CSC 141 Introduction to Computer Programming Fundamentals of Characters and Strings In C language characters is either printable or nonprintable including lowercase letters, uppercase letters, decimal digits, special characters and escape sequences. A character is usually stored in the computer as an 8-bits (1 byte) integer. The integer value stored for a character depends on the character set used by the computer on which the program is running. CSC 141 Introduction to Computer Programming There are two commonly used character codes: ASCII (American Standard Code for Information Interchange) EBCDIC (Extended Binary Coded Decimal Interchange Code) Fundamentals of Characters and Strings CSC 141 Introduction to Computer Programming char num = 1 and char num = ‘1’ are not the same. char num = 1 is represented in the computer as 00000001. char num = ‘1’ on the other hand is number 49 according to the ASCII character set. Therefore, it is represented in the computer as 00110001. Difference Between an Integer Digit and a Character Digit CSC 141 Introduction to Computer Programming Example: ASCII character #include void main(void) { char A = 'A'; char Z = 'Z'; char a = 'a'; char z = 'z'; printf("\nASCII value for A is %d\t", A); printf("\nASCII value for Z is %d\t", Z); printf("\nASCII value for a is %d\t", a); printf("\nASCII value for z is %d\t", z); printf("\n"); printf("\n Decimal 65 in ASCII represents %c\t",65); printf("\n Decimal 90 in ASCII represents %c\t",90); printf("\n Decimal 97 in ASCII represents %c\t",97); printf("\n Decimal 122 in ASCII represents %c\t",122); } CSC 141 Introduction to Computer Programming Sample output ASCII value for A is 65 ASCII value for Z is 90 ASCII value for a is 97 ASCII value for z is 122 | CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 21 Thanks for Lecture Slides: Principles of Programming - NI2005 CSC 141 Introduction to Computer Programming Fundamentals of Characters and Strings In C language characters is either printable or nonprintable including lowercase letters, uppercase letters, decimal digits, special characters and escape sequences. A character is usually stored in the computer as an 8-bits (1 byte) integer. The integer value stored for a character depends on the character set used by the computer on which the program is running. CSC 141 Introduction to Computer Programming There are two commonly used character codes: ASCII (American Standard Code for Information Interchange) EBCDIC (Extended Binary Coded Decimal Interchange Code) Fundamentals of Characters and Strings CSC 141 Introduction to Computer Programming char num = 1 and char num = ‘1’

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.