Đang chuẩn bị liên kết để tải về tài liệu:
Module 2 Introducing Data Types and Operators
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
At the core of a programming language are its data types and operators. These elements define the limits of a language and determine the kind of tasks to which it can be applied. As you might expect, C++ supports a rich assortment of both data types and operators, making it suitable for a wide range of programming. Data types and operators are a large subject. We will begin here with an examination of C++’s foundational data types and its most commonly used operators. We will also take a closer look at variables and examine the expression | Module 2 Introducing Data Types and Operators Table of Contents CRITICAL SKILL 2.1 The C Data Types.2 Project 2-1 Talking to Mars.10 CRITICAL SKILL 2.2 Literals.12 CRITICAL SKILL 2.3 A Closer Look at Variables.15 CRITICAL SKILL 2.4 Arithmetic Operators.17 CRITICAL SKILL 2.5 Relational and Logical Operators.20 Project 2-2 Construct an XOR Logical Operation.22 CRITICAL SKILL 2.6 The Assignment Operator.25 CRITICAL SKILL 2.7 Compound Assignments.25 CRITICAL SKILL 2.8 Type Conversion in Assignments.26 CRITICAL SKILL 2.9 Type Conversion in Expressions.27 CRITICAL SKILL 2.10 Casts.27 CRITICAL SKILL 2.11 Spacing and Parentheses.28 Project 2-3 Compute the Regular Payments on a Loan.29 At the core of a programming language are its data types and operators. These elements define the limits of a language and determine the kind of tasks to which it can be applied. As you might expect C supports a rich assortment of both data types and operators making it suitable for a wide range of programming. Data types and operators are a large subject. We will begin here with an examination of C s foundational data types and its most commonly used operators. We will also take a closer look at variables and examine the expression. 1 C A Beginner s Guide by Herbert Schildt Why Data Types Are Important The data type of a variable is important because it determines the operations that are allowed and the range of values that can be stored. C defines several types of data and each type has unique characteristics. Because data types differ all variables must be declared prior to their use and a variable declaration always includes a type specifier. The compiler requires this information in order to generate correct code. In C there is no concept of a type-less variable. A second reason that data types are important to C programming is that several of the basic types are closely tied to the building blocks upon which the computer operates bytes and words. Thus C lets you operate on the same .