Download presentation
Presentation is loading. Please wait.
Published byWalter Moore Modified over 6 years ago
1
Programmer-Defined Functions, Call-by-Value, Multiple Files Lab 5
Lab Instructor: Salem Othman
2
Review Go to Dr. Mikhail Nesterenko website and read the topics:
Programmer-defined functions, local and global variables, call-by-value Separate files, independent compilation, header files Void-functions, predicates, call-by-reference You need to understand: Programmer-Defined Functions function name, function head, function body, return type, return statement Function Invocation (caller, callee) Function arguments Function Prototype Local Variables Global Constants and Variables Call-by-Value Program in Multiple Files Include Files Multiple Inclusion Protection
3
Function argument double circleArea (double r) {
function name parameter return type argument double circleArea (double r) { const double PI = ; return PI * r * r; } function head cout << circleArea(4)+6 << endl; invocation function body return statement
4
2 5 1 2 5 1 8 2 5 1 2 5 1 8 var1 var2 var3 result arg1 arg2 arg3
2 5 1 2 5 1 8 arg1 arg2 arg3 result 2 5 1 2 5 1 8
5
sum.cpp
6
Sum.h sum.cpp sumFun.cpp
7
Multiple Inclusion Protection
header file myheader.h containing definitions usually has the following structure: #ifndef MYHEADER_H #define MYHEADER_H // text of the header file goes here #endif
8
Character
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.