Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Chapter 3 Function Basics
Đang chuẩn bị liên kết để tải về tài liệu:
Chapter 3 Function Basics
Kim Anh
96
41
ppt
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Transfers control back to "calling" function For return type other than void, MUST have return statement Typically the LAST statement in function definition return statement optional for void functions. | Chapter 3 Function Basics Learning Objectives Predefined Functions Those that return a value and those that don’t Programmer-defined Functions Defining, Declaring, Calling Recursive Functions Scope Rules Local variables Global constants and global variables Blocks, nested scopes Introduction to Functions Building Blocks of Programs Other terminology in other languages: Procedures, subprograms, methods In C++: functions I-P-O Input – Process – Output Basic subparts to any program Use functions for these "pieces" Predefined Functions Libraries full of functions for our use! Two types: Those that return a value Those that do not (void) Must "#include" appropriate library e.g., , (Original "C" libraries) (for cout, cin) Using Predefined Functions Math functions very plentiful Found in library Most return a value (the "answer") Example: theRoot = sqrt(9.0); Components: sqrt = name of library function theRoot = variable used to assign "answer" to 9.0 = | Chapter 3 Function Basics Learning Objectives Predefined Functions Those that return a value and those that don’t Programmer-defined Functions Defining, Declaring, Calling Recursive Functions Scope Rules Local variables Global constants and global variables Blocks, nested scopes Introduction to Functions Building Blocks of Programs Other terminology in other languages: Procedures, subprograms, methods In C++: functions I-P-O Input – Process – Output Basic subparts to any program Use functions for these "pieces" Predefined Functions Libraries full of functions for our use! Two types: Those that return a value Those that do not (void) Must "#include" appropriate library e.g., , (Original "C" libraries) (for cout, cin) Using Predefined Functions Math functions very plentiful Found in library Most return a value (the "answer") Example: theRoot = sqrt(9.0); Components: sqrt = name of library function theRoot = variable used to assign "answer" to 9.0 = argument or "starting input" for function In I-P-O: I = 9.0 P = "compute the square root" O = 3, which is returned & assigned to theRoot The Function Call Back to this assignment: theRoot = sqrt(9.0); The expression "sqrt(9.0)" is known as a function call, or function invocation The argument in a function call (9.0) can be a literal, a variable, or an expression The call itself can be part of an expression: bonus = sqrt(sales)/10; A function call is allowed wherever it’s legal to use an expression of the function’s return type A Larger Example: Display 3.1 A Predefined Function That Returns a Value (1 of 2) A Larger Example: Display 3.1 A Predefined Function That Returns a Value (2 of 2) More Predefined Functions #include Library contains functions like: abs() // Returns absolute value of an int labs() // Returns absolute value of a long int *fabs() // Returns absolute value of a float *fabs() is actually in library ! Can be confusing Remember: libraries were added
TÀI LIỆU LIÊN QUAN
Chapter 3 Function Basics
Network Fundamentals–Chapter 3
Structure and Function in Agroecosystem Design and Management - Chapter 3
Lecture Database - Chapter 9(3): Stored procedures and function
Lecture Molecular biology: Chapter 3 - Robert F. Weaver
Lecture Principles of biochemistry - Chapter 4 (part 3): 3-D structure/Function
Lecture Molecular biology (Fifth Edition): Chapter 3 - Robert F. Weaver
Lecture Business marketing: Connecting strategy, relationships, and learning (4/e): Chapter 3 - Dwyer, Tanner
Lecture The economics of Money, Banking and Financial markets: Chapter 3 - Frederic S. Mishkin, Apostolos Serletis
Chapter 3: Cellular Structure and Function
crossorigin="anonymous">
Đã 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.