tailieunhanh - Lecture C++ programming: from problem analysis to program design - Chapter 6: User-defined functions I

Lecture C++ programming: from problem analysis to program design - Chapter 6: User-defined functions I. In this chapter, you will: Learn about standard (predefined) functions and discover how to use them in a program; learn about user-defined functions; examine value-returning functions, including actual and formal parameters; explore how to construct and use a value-returning, user-defined function in a program. | C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives In this chapter, you will: Learn about standard (predefined) functions and discover how to use them in a program Learn about user-defined functions Examine value-returning functions, including actual and formal parameters Explore how to construct and use a value-returning, user-defined function in a program C++ Programming: From Problem Analysis to Program Design, Fourth Edition Introduction Functions are like building blocks They allow complicated programs to be divided into manageable pieces Some advantages of functions: A programmer can focus on just that part of the program and construct it, debug it, and perfect it Different people can work on different functions simultaneously Can be re-used (even in different programs) Enhance program readability C++ Programming: From Problem . | C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives In this chapter, you will: Learn about standard (predefined) functions and discover how to use them in a program Learn about user-defined functions Examine value-returning functions, including actual and formal parameters Explore how to construct and use a value-returning, user-defined function in a program C++ Programming: From Problem Analysis to Program Design, Fourth Edition Introduction Functions are like building blocks They allow complicated programs to be divided into manageable pieces Some advantages of functions: A programmer can focus on just that part of the program and construct it, debug it, and perfect it Different people can work on different functions simultaneously Can be re-used (even in different programs) Enhance program readability C++ Programming: From Problem Analysis to Program Design, Fourth Edition Introduction (continued) Functions Called modules Like miniature programs Can be put together to form a larger program C++ Programming: From Problem Analysis to Program Design, Fourth Edition Predefined Functions In algebra, a function is defined as a rule or correspondence between values, called the function’s arguments, and the unique value of the function associated with the arguments If f(x) = 2x + 5, then f(1) = 7, f(2) = 9, and f(3) = 11 1, 2, and 3 are arguments 7, 9, and 11 are the corresponding values C++ Programming: From Problem Analysis to Program Design, Fourth Edition Predefined Functions (continued) Some of the predefined mathematical functions are: sqrt(x) pow(x, y) floor(x) Predefined functions are organized into separate libraries I/O functions are in iostream header Math functions are in cmath header C++ Programming: From Problem Analysis to Program Design, Fourth Edition Predefined Functions (continued) .

TỪ KHÓA LIÊN QUAN