Chapter (3) - Procedures

Slides:



Advertisements
Similar presentations
Classes & Objects INTRODUCTION : This chapter introduces classes ; explains data hiding, abstraction & encapsulation and shows how a class implements these.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 1.
1 Storage Duration and Scope –Local and global variables Storage classes –automatic, static, external, register Todays Material.
Spring Semester 2013 Lecture 5
Pass by Value. COMP104 Pass by Value / Slide 2 Passing Parameters by Value * A function returns a single result (assuming the function is not a void function)
Template. 2 Using templates, it is possible to create generic functions and classes. In a generic function or class, the type of data upon which the function.
Murach, Chapter 6. Murach’s Visual Basic 2008, C6© 2008, Mike Murach & Associates, Inc. Slide 2.
Chapter 9 Pointers and Dynamic Arrays. Overview 9.1 Pointers 9.2 Dynamic Arrays.
Chapter 8 Scope, Lifetime and More on Functions. Definitions Scope –The region of program code where it is legal to reference (use) an identifier Three.
distributive=to give out
AU/MITM/1.6 By Mohammed A. Saleh 1. Arguments passed by reference  Until now, in all the functions we have seen, the arguments passed to the functions.
Variable types We have already encountered the idea of a variable type. It is also possible to think about variables in terms of their kind, namely: 1)
Week 4 Recap CSE 115 Spring Formal Parameter Lists Comma-separated list of formal parameters Formal parameters are listed giving the type of the.
Chapter 4 (cont) Sec. 4.1, 4.2, 4.4 Procedures (User-defined)
Chapter 41 Sub Procedures, Part II (Continue). Chapter 42 Local Variable A variable declared inside a Sub procedure with a Dim statement Space reserved.
ISE 582: Web Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 4 JAVA Cup.
Chapter 41 General Procedures Sub Procedures, Part I Sub Procedures, Part II Function Procedures.
Chapter 6: Function. Scope of Variable A scope is a region of the program and broadly speaking there are three places, where variables can be declared:
Introduction to Class Modules Please use speaker notes for additional information!
Subroutines Just like C, PERL offers the ability to use subroutines for all the same reasons – Code that you will use over and over again – Breaking large.
Call-by-Value vs. Call-by-Reference Call-by-value parameters are used for passing information from the calling function to the called function (input parameters).
Chapter 13, Slide 1 Exception Handling Exception handling is a language feature that allows the programmer to handle runtime "exceptional conditions."
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Scope of Variables. A variable can have something called a ‘scope’. This refers to its accessibility. Scope of Variable Mr.Skelton …Dalriada School Scope.
1 Procedures Blocks of code which can be called from anywhere in a program Enable us to avoid needless repetition of the same code Can take parameters.
CSCI 130 Chapter 5 Functions. Functions are named uniquely Performs a specific task Is independent –should not interfere with other parts of program May.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 7 Sub and Function Procedures.
David Stotts Computer Science Department UNC Chapel Hill.
Classes In C++ 1. What is a class Can make a new type in C++ by declaring a class. A class is an expanded concept of a data structure: instead of holding.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Sub Procedures. A Sub procedure is a block of code that is executed in response to an event. There are two types of Sub procedures, general procedures.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 10: Chapter 6: Slide 1 Unit 10 Sub Procedures and Functions Chapter 6 Sub.
Procedural Programming Criteria: P2 Task: 1.2 Thomas Jazwinski.
Chapter 10: JavaScript Functions CIS 275—Web Application Development for Business I.
1 Structure of a C Program (continued) Presentation original from Dr. Turner’s class USF - COP C for Engineers Summer 2008.
1 Unstructured Programming The Need for Procedures/Functions Procedural Programming Function Declaration/Prototypes/Invocation Example Functions Function.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
FUNCTION Functions is a sub-program that contains one or more statements and it performs some task when called.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Functional Abstraction Reduces Complexity.
Department of Electronic & Electrical Engineering Functions Parameters Arguments Pointers/dereference & * Scope Global/Local Storage Static/Automatic.
Passing Function Arguments by Reference : A Sample Lesson for CS 1 using the C Programming Language Andy D. Digh Friday, May 29th, 1998.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Objectives: How to define and call functions. Function declarations and how they differ from function definitions. How arguments are passed to functions.
Variable Scope. When you declare a variable, that name and value is only “alive” for some parts of the program  We must declare variables before we use.
CS0004: Introduction to Programming
Functions + Overloading + Scope
Chapter 9: Value-Returning Functions
3rd prep. – 2nd Term MOE Book Questions.
Chapter 6: Functions Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Using local variable without initialization is an error.
Tips Need to Consider When Organizing a College Event
Procedures Programming Guides.
Signal & Variables April 14,2007 DSD,USIT,GGSIPU.
Chapter 4 (part 2).
6 Chapter Functions.
ماجستير إدارة المعارض من بريطانيا
CIS16 Application Development and Programming using Visual Basic.net
Herbert G. Mayer, PSU CS Status 8/2/2013
Chapter 9: Value-Returning Functions
Which best describes the relationship between classes and objects?
Chapter 20: Programming Functions
A function is a group of statements that exist within a program for the purpose of performing a specific task. We can use functions to divide and conquer.
Scope J. Michael Moore.
Brent M. Dingle Texas A&M University Chapter 5 – Section 2-3
[Event Title Here] [Event Title Here] [Event Title Here]
Brent M. Dingle Texas A&M University Chapter 5 – Section 1

Methods Scope How are names handled?
Scope Rules.
Programming Techniques
Presentation transcript:

Chapter (3) - Procedures Questions

We can notice the declaration of the following : 1 ."Class" is under the name (Form1) 2"Variables" are under the names (total, i) 3-"Event procedures" are under the name of (Button1_Click, Button2_Click(

Here we declare what is so-called (Procedures); this declaration is done only once and then, you recall the procedures many times from anywhere in your program; which avoids code duplication in places where procedures are recalled.

Note: In the procedure declaration, we can use more than one Parameter. When the procedure is recalled, we determine values of the outside procedure called (Argument).

Declaration of Function SUM Calling of Function SUM