Absolute C++ (4th Edition) part 10

Absolute C++ (4th Edition) part 10. 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. . | Function Basics Good things come in small packages. Common saying Introduction If you have programmed in some other language then the contents of this chapter will be familiar to you. You should still scan this chapter to see the C syntax and terminology for the basics of functions. Chapter 4 contains the material on functions that might be different in C than in other languages. A program can be thought of as consisting of subparts such as obtaining the input data calculating the output data and displaying the output data. C like most programming languages has facilities to name and code each of these subparts separately. In C these subparts are called functions. Most programming languages have functions or something similar to functions although they are not always called by that name in other languages. The terms procedure subprogram and method which you may have heard before mean essentially the same thing as function. In C a function may return a value produce a value or may perform some action without returning a value but whether the subpart returns a value or not it is still called a function in C . This chapter presents the basic details about C functions. Before telling you how to write your own functions we will first tell you how to use some predefined C functions. Predefined Functions Do not reinvent the wheel. Common saying C comes with libraries of predefined functions that you can use in your programs. There are two kinds of functions in C functions that return produce a value and functions that do not return a value. Functions that do void not return a value are called void functions. We first discuss functions that return a value and then discuss void functions. predefined functions that return a value We will use the sqrt function to illustrate how you use a predefined function that returns a value. The sqrt function calculates the square root of a number. Predefined Functions 93 The square root of a number is that number which when .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.