Anda di halaman 1dari 2

Subject: TLE ICT Yr. & Sec.

IV-FGH IV-JL IV-BC IV-OQ IV-ST

Date: Oct. 11, 2010 (Mon) Time


6:00 6:50 6:50 7:40 9:00 9:50 10:40 11:30 12:00 12:50 (M, T, W, F) (M, T Th, F) (M, T, W, Th) (M, W, Th, F) (T, W, Th, F)

*Modulus returns the remainder of a division Example: 7%2 result: 1 6%2 result: 0 * Negation stands for a negative value Example: -5 -20 * You cannot divide by zero. The result will be an error message. 2. When multiple operations are involved in a problem, the order of the operators will be as follows: 1st negation 2nd Exponentiation 3rd Multiplication, Division th 4 Addition, Subtraction 5th Modulus 3. Illustrate examples: * Example 1 5+(4*2/2)-3+3 = 6 5+(8/2)-3+3 (5+4)-3+3 9-3 6 * Example 2 C = 5/9*(F-32) C. Application // arith.cpp -- some C++ arithmetic #include <iostream> int main() { using namespace std; float hats, heads; cout.setf(ios_base::fixed, ios_base::floatfield); // fixed-point cout << "Enter a number: "; cin >> hats; cout << "Enter another number: "; cin >> heads; cout << "hats = " << hats << "; heads = " << heads << endl; cout << "hats + heads = " << hats + heads << endl; cout << "hats - heads = " << hats heads << endl; cout << "hats * heads = " << hats * heads << endl; cout << "hats / heads = " << hats / heads << endl; return 0;

I.

Objectives 1. Give the meaning of arithmetic operators in C++. 2. Apply effectively the arithmetic operators in C++ syntax 3. Follow the order of operators in a problem solving.

II. Subject Matter A. Topic: Basic Programming Sub-topic: Arithmetic Operators B. Reference: Introduction to Programming by Trajano, pages 38-39 Materials: chart, whiteboard and marker Values Integration: Good students follow rules III. Procedure A. Preparation 1. Daily Routine Prayer and greeting Checking of attendance Checking of assignment 2. Review of Past Lesson: int is a whole number (0 to 9) consisting of an optional sign (+ or -) Examples: (age) 15; (number) 289067 float or double are numbers with decimal or fractional parts. Examples: (price) 5.19, (temperature) .056, 88.88, 145.7896 3. Motivation: What makes a good student? B. Lesson Proper 1. Ask students to complete the chart
FUNCTION Addition Subtraction Multiplication Division Exponentiation Modulus (Remainder) Negation OPERATOR + * / ^ % EXAMPLE 8+1 8-1 8*8 8/4 8^2 8% 5 -8 RESULT 9 7 64 2 64 3 -8

Note:

Enter a number: 50.25

Enter another number: 11.17 hats = 50.250000; heads = 11.170000 hats + heads = 61.419998 hats - heads = 39.080002 hats * heads = 561.292480 hats / heads = 4.498657 D. Generalization What are operators? Operators are symbols that tell the compiler to perform specific mathematical or logical manipulations. Arithmetic operators are symbols that indicate the operation to be performed. IV. Evaluation Analyze the conditions given. Write the result on the space provided: 1. 10/5 + 7 -3 2. 25%5 3. 8 + (9 * 3 / 3) 8 +4 4. 5^3-6*7 5. 10%10007 V. Assignment 1. Give the meaning of relational operator. 2. Give some examples of relational oeperators.

Anda mungkin juga menyukai