Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Introduction to computer and programming - Lecture No 6
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
This lesson looks at the processors most commonly found in personal computers and describes some of their most important features and distinguishing characteristics. You w ill learn how these CPUs arc typically differentiated from one another and sec how their performance is measured. You also w ill learn some of the ways you can extend the power of your PC’s processor to other components by using its expansion capabilities. | CSC103: Introduction to Computer and Programming Lecture No 6 Previous lecture Escape sequences C compiler Directives Common errors Today’s lecture outline C character set Basic constants and variables Output function – printf Input function – scanf C instructions Integer to float conversion Hierarchy of operator Control instructions Learning C/C++ 4 C Character Set 5 Constants An entity that doesn’t change 6 Integer Constants Must have at least one digit It must not have a decimal point It can be either positive or negative If there is no sign an integer constant is assumed to be positive No commas or blanks are allowed within an integer constant Examples: 135, -67, 3401, -5670 7 Real Constants Also called Floating Point constants A real constant must have at least one digit It must have a decimal point It could be either positive or negative Default sign is positive No commas or blanks are allowed within a real constant Examples: +325.34, 426.0, -32.76, -48.5792 8 Character Constants A character constant is a single alphabet a single digit or a single special symbol Enclosed within single inverted commas Both the inverted commas should point to the left The maximum length can be 1 character Examples: ’A’, ‘I’, ‘5’, ‘=‘ 9 Variables An entity that may vary during program execution Names given to locations in memory 10 Variables Series of characters (letters, digits, underscores) Must begin with a letter or underscore Case sensitive Meaningful naming scheme 11 Variables No commas or blanks are allowed within a variable name. No Special symbol are used in name. Examples: Interger1, Sum, _FirstNum Invalid variable names #sum, 12x, first name 12 Keywords Meaning already explained to compiler Cannot be used as variable name 13 Writing C/C++ Programs Instructions as statements Order of statements Each statement must end with a ; Blanks for readability or clarity Case-Sensitive 14 Gross salary C Program Go to program 15 Variable declaration Any variable used in the . | CSC103: Introduction to Computer and Programming Lecture No 6 Previous lecture Escape sequences C compiler Directives Common errors Today’s lecture outline C character set Basic constants and variables Output function – printf Input function – scanf C instructions Integer to float conversion Hierarchy of operator Control instructions Learning C/C++ 4 C Character Set 5 Constants An entity that doesn’t change 6 Integer Constants Must have at least one digit It must not have a decimal point It can be either positive or negative If there is no sign an integer constant is assumed to be positive No commas or blanks are allowed within an integer constant Examples: 135, -67, 3401, -5670 7 Real Constants Also called Floating Point constants A real constant must have at least one digit It must have a decimal point It could be either positive or negative Default sign is positive No commas or blanks are allowed within a real constant Examples: +325.34, 426.0, -32.76, -48.5792 8 Character .