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

In this chapter, you will: Learn how to construct and use void functions in a program, discover the difference between value and reference parameters, explore reference parameters and value-returning functions, learn about the scope of an identifier, examine the difference between local and global identifiers, discover static variables, learn function overloading, explore functions with default parameters. | C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 7: User-Defined Functions II C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives In this chapter, you will: Learn how to construct and use void functions in a program Discover the difference between value and reference parameters Explore reference parameters and value-returning functions Learn about the scope of an identifier C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives (continued) Examine the difference between local and global identifiers Discover static variables Learn function overloading Explore functions with default parameters C++ Programming: From Problem Analysis to Program Design, Fourth Edition Void Functions Void functions and value-returning functions have similar structures Both have a heading part and a statement part User-defined void functions can be placed either before or after the function main If . | C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 7: User-Defined Functions II C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives In this chapter, you will: Learn how to construct and use void functions in a program Discover the difference between value and reference parameters Explore reference parameters and value-returning functions Learn about the scope of an identifier C++ Programming: From Problem Analysis to Program Design, Fourth Edition Objectives (continued) Examine the difference between local and global identifiers Discover static variables Learn function overloading Explore functions with default parameters C++ Programming: From Problem Analysis to Program Design, Fourth Edition Void Functions Void functions and value-returning functions have similar structures Both have a heading part and a statement part User-defined void functions can be placed either before or after the function main If user-defined void functions are placed after the function main The function prototype must be placed before the function main C++ Programming: From Problem Analysis to Program Design, Fourth Edition Void Functions (continued) A void function does not have a return type return statement without any value is typically used to exit the function early Formal parameters are optional A call to a void function is a stand-alone statement C++ Programming: From Problem Analysis to Program Design, Fourth Edition Void Functions without Parameters Function definition syntax: void is a reserved word Function call syntax: C++ Programming: From Problem Analysis to Program Design, Fourth Edition Void Functions with Parameters Function definition syntax: Formal parameter list syntax: Function call syntax: Actual parameter list syntax: C++ Programming: From Problem Analysis to Program Design, Fourth Edition Void Functions with Parameters (continued) C++ Programming: From Problem Analysis to

TỪ KHÓA LIÊN QUAN