TAILIEUCHUNG - Absolute C++ (4th Edition) part 3

Absolute C++ (4th Edition) part 3. KEY BENEFIT: C++ programming concepts and techniques are presented in a straightforward style using understandable language and code. KEY TOPICS: C++ Basics; Flow of Control; Function Basics; Parameters and Overloading; Arrays; Structures and Classes; Constructors; Operator Overloading, Friends, and References; Strings; Pointers and Dynamic Arrays; Separate Compilation and Namespaces; Streams and File I/O; Recursion; Inheritance; Polymorphism and Virtual Functions; Templates; Linked Data Structures; Exception Handling; Standard Template Library; Patterns and UML. MARKET: Useful for both beginning and intermediate C++ programmers. . | Variables Expressions and Assignment Statements 21 Naming Constants with the const Modifier When you initialize a variable inside a declaration you can mark the variable so that the program is not allowed to change its value. To do this place the word const in front of the declaration as described below Syntax const Type_Name Variable_Name Constant Examples const int MAX_TRIES 3 const double PI an addition it is usually best to include the parentheses even if the intended order of operations is the one dictated by the precedence rules. The parentheses make the expression easier to read and less prone to programmer error. A complete set of C precedence rules is given in Appendix 2. integer and floating-point division When used with one or both operands of type double the division operator integer behaves as you might expect. However when used with two operands of type int the division division operator yields the integer part resulting from division. In other words integer division discards the part after the decimal point. So 10 3 is 3 not . 5 2 is 2 not and 11 3 is 3 not . . Notice that the number is not rounded the part after the decimal point is discarded no matter how large it is. The operator can be used with operands of type int to recover the information the lost when you use to do division with numbers of type int. When used with values of operator type int the two operators and yield the two numbers produced when you perform the long division algorithm you learned in grade school. For example 17 divided by 5 yields 3 with a remainder of 2. The operation yields the number of times one number goes into another. The operation gives the remainder. For example the statements cout 17 divided by 5 is 17 5 n cout with a remainder of 17 5 n yield the following output 17 divided by 5 is 3 with a remainder of 2 When used with negative values of type int the result of the operators and can be different for different implementations of C . Thus

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.