Functions (Lesson Plan)
Functions (Lesson Plan)
Functions (Lesson Plan)
I. Objectives:
At the end of the lesson, the student should be able to:
1. acquaint themselves with functions;
2. familiarize with the syntactical structure of function; and
3. construct a simple program.
II. Subject Matter:
a. Topic concepts
Major: Functions
Sub Topic: Function Construction
b. Values Integrated: Patience, Focus, Willingness to learn, Understanding,
Appreciation, Creativity, and Mastery of Skills
c. References:
Problem Solving with C++ The Object of Functions, by: Walter Savitch
www.cplusplus.com.ph
d. Materials:
Swish Max Presentation
Projector
Cartolina
Whiteboard
d. Collecting of Assignment
e. Review
2. Motivation:
Students will play a game called Pinoy Henyo where one student
will guess the word and the other one will be the coach. This will be
played by 3 pairs of students.
B. Developmental Activities
1. Lesson Proper
Functions
Allow to structure programs in segments of code to perform individual
tasks. It was also a group of statements that is given a name, and which can be
called from some point of the program.
Defining Function
To define a C++ function, there are two steps (preferably but not
mandatory)
Step #1 declare the function signature in either a header file (.h file) or
before the main function of the program
Step #2 Implement the function in either an implementation file (.cpp) or
after the main function
Where:
Syntax Structure:
type name ( ) { statements }
2. Application
The teacher will give an activity wherein the student(s) will make
the program run by means of debugging and of right use of syntactical
structure of function.
IV. Generalization
A function is an assignment or a task that must be performed to complement the
other part(s) of a program. There are two kinds of functions: those supplied to you and
those you will be writing. The functions that are supplied to you are usually in three
categories: those built-in the operating system, those written in C++ (they are part of
the C++ language), and those supplied with your programming environment. The use
of these functions is the same regardless of the means you get them; you should
know what a function looks like, how to create one, what functions are already
available, where they are located, and what a particular function does, how and when
to use it.
V. Evaluation
Multiple Choice: Write the letter (uppercase) of the correct answer after
each number.
B.
C.
D.
2. What is the return type of the function with prototype: "int func(char x, float v,
double t);"
A. Char
B. Int
C. Float
D. double
3. Which is not a proper prototype?
A. int funct(char x, char y);
B. double funct(char x)
C. void funct();
D. char x();
4. Which of the following function declaration is/are incorrect?
A.
B.
C.
D.
Answer Key:
1.
2.
3.
4.
5.
D
B
B
C
B
VI. Assignment
Follow-Up
Research or think of a possible program that may benefit you or the
society using Functions. Write your idea in sheet of yellow paper. Submission will be
on March 05, 2014.
Advance
Prepared by:
Checked by:
Approved by: