 Experiment 07 Function Dr. rer.nat. Jing LU

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1.
Advertisements

Computer Graphics- SCC 342
Functions. COMP104 Functions / Slide 2 Introduction to Functions * A complex problem is often easier to solve by dividing it into several smaller parts,
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 5 Functions for All Subtasks.
Lab 8 User Defined Function.
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
Integers less than 0 are (positive, negative) integers.
More on Functions Programming. COMP104 Lecture 19 / Slide 2 Passing Parameters by Reference l To have a function with multiple outputs, we have to use.
Writing and Testing Programs Drivers and Stubs Supplement to text.
11.3 Function Prototypes A Function Prototype contains the function’s return type, name and parameter list Writing the function prototype is “declaring”
CS150 Introduction to Computer Science 1
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
(a) (b) (c) (d). What is (1,2,3)  (3,4,2)? (a) (1, 2, 3, 4) (b) (1,2)  (3,4) (c) (1,3,4,2) (d) (3,1)  (4,2)
Relation Input Output Function Domain Range Scatter Plot Linear Equation x - intercept y- intercept Slope Rise Run.
Calculating Mechanical Advantage Inclined Plane, Pulley, Lever.
The Distance and Midpoint Formulas Goal 1 Find the Midpoint of a Segment Goal 2 Find the distance between two points on a coordinate plane Goal 3 Find.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
 Experiment 11 Structured and Unions Dr. rer.nat. Jing LU
WARMUP Take a sheet of graph paper. Plot the following points and state the quadrant they are in (5, 2) (-4, 3) (-1, -4) (3, -5)
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
Factorial Notation For any positive integer n, n! means: n (n – 1) (n – 2)... (3) (2) (1) 0! will be defined as equal to one. Examples: 4! = =
Warm Up. FUNCTIONS DEFINED Essential Question: How can you determine if a relation is a function?
Homework Assignment #3 J. H. Wang Oct. 29, 2007.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
Relations as Ordered Pairs A light plane glides when the engine is turned off. Pilots use the saying “five for one”. This means that the plane will glide.
Intro to Nested Looping Intro to Computer Science CS1510 Dr. Sarah Diesburg.
Productivity. Calculating productivity Total output Total input Chocolate wave factory has 3000 waves 10 workers 300 waves per worker.
COMPASS Practice Test 14  A.  B.  C. 1. What is the value of when x = -5?  D. -3  E. 3.
Find the equation of the line with: 1. m = 3, b = m = -2, b = 5 3. m = 2 (1, 4) 4. m = -3 (-2, 8) y = 3x – 2 y = -2x + 5 y = -3x + 2 y = 2x + 2.
Exercise 3 Example> Write a C function that implements /* input : integer value n output : */ int f ( int n ) { int i, sum=0; for (i=1;i
COMPASS Test Model Help What is the sum of the solutions of the equation  A. 8  B.-8  C. 2  D.-2  E. 15 Go on Calculator.
4.7 Triangles and Coordinate Review of Distance formula and Midpoint formula.
Recursion A function is said to be recursive if it calls itself, either directly or indirectly. void repeat( int n ) { cout
1 CSC103: Introduction to Computer and Programming Lecture No 16.
CONSECUTIVE INTEGERS. CONSECUTIVE INTEGERS - Consecutive integers are integers that follow each other in order. They have a difference of 1 between each.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Parametric and general equation of a geometrical object O EQUATION INPUT t OUTPUT EQUATION INPUT OUTPUT (x, y, z)
The Distance and Midpoint Formulas Goal 1 Find the Midpoint of a Segment Goal 2 Find the distance between two points on a coordinate plane Goal 3 Find.
Free International University of Moldova Faculty of Informatics and Engineering DIGITAL SIGNALS PROCESSING Course of lectures Theme: THE SIGNALS FUNCTIONAL.
Hosted By Your wonderful teacher Mr. Embree Terms coordinate plane Integers Evaluate expressions
Exercise 2 : Using for loop Repetition (loop) (1)control variable initialization (2)Test Conditon (3)Modification of control variable value order : (1)
Circles in the Coordinate Plane
Multiplication
2.1 Relations and Functions
Experiment 01 C programming environment
3.2 Graphs of Linear Equations in Two Variables
Coordinate Geometry Notes Name:____________________________
Multiplication
Consecutive Integers.
Get out your classwork from yesterday so we can go over #25!
L16 Cost Functions.
L16 Cost Functions.
Notes #3 (1.3) 1-3 Distance and Midpoints
/s Fig. P3.18, p.72.
An Advertisement for Algebra!
1 Introduction to Algebra: Integers.
The Distance Formula     Understand horizontal/vertical distance in a coordinate system as absolute value of the difference between coordinates;
Function Rules and Tables.
Objective: To calculate midpoint and distance in the xy-plane.
1.1- Relations and Functions
Unit 3 Review (Calculator)
Fundamental Programming
National Central University, Taiwan
Rate of Change The rate of change is the change in y-values over the change in x-values.
Group Members First Names
Question 12.
Calculate 9 x 81 = x 3 3 x 3 x 3 x 3 3 x 3 x 3 x 3 x 3 x 3 x =
Take out your agenda and write your homework in it.
1.8 Consecutive Integers Notes on Handout.
The Distance Formula     Understand horizontal/vertical distance in a coordinate system as absolute value of the difference between coordinates;
Presentation transcript:

 Experiment 07 Function Dr. rer.nat. Jing LU

Goal  How to define and call a function?  How to write a function?  What is the parameter in a function? What is the return value?  How to use local parameter and global parameter?  How to debug a function?

Practice 01  Input two integers, output the sum of the two integers, implement it using function;

Practice 02  Input some positive integers, ending with 0. Calculate the sum of all odd numbers. Implement it in function.

Practice 03  Input the coordinates of two points (x1,y1) and (x2, y2) in the plane surface. Calculate the distance of the two points. Use function distance (x1,y1,x2,y2).

Practice 04  Input an integer, output the factorial. Use function.

Result and Analysis  Why we want a function?  How is your conclusion of using a function? Advantages and disadvantages.