Procedural Programming
|
|
- Francis Felix Wilkins
- 6 years ago
- Views:
Transcription
1 Procedural Programming Lecture 2 - Summer Semester 2017 Control Structures Flow Charts Faculty of Engineering Institute of Computer Engineering Practical Training REGISTRATION ends tomorrow Wednesday (26 th of April 2017) at 12:00 REGISTRATION under en/education/ teaching/ss17/pp/lab/registration/index.php Time schedule and group list will be announced Thursday (26 th of April 2017) under en/education/teaching/ss17/pp/lab/index.php More information during the first exercise next Tuesday (2 nd of May 2017) 2 1
2 What we know so far... Programming is only one step in program development process We use computers to solve problems Therefore, we reduce complex problems into more simple parts applying problem-solving strategies Abstraction cascade: from system to model By algorithms we structure a solution approach into a sequence of instructions to follow for solving a problem Flow of changes to model state Programs are translations of algorithms that we have written in a programming language and which can be understood and executed by computers Instructions (the program) operate on data, which represents the model. Both are stored in the main memory of a computer. 3 How to cross the river? A farmer with a fox, a goose, and a sack of corn needs to cross the river. The boat can carry the farmer and only one item at a time. The fox cannot be left on the same shore as the goose, and the goose cannot be left on the same shore as the sack of corn without the farmer watching them. 4 2
3 How to cross the river? A farmer with a fox,a goose,and a sack of corn needs to cross the river. The boat can carry the farmer and only one item at a time.thefox cannot be leftonthesameshoreasthegoose,andthegoose cannot be left on the same shore as the sack of corn without the farmer watching them. 5 Perform according to Program Development Process Building up a self contained model of the problem situation: Restate the problem by collecting all facts Reduce the problem to relevant parts 6 3
4 How to cross the river? Restate the problem A farmer with a fox,a goose,and a sack of corn needs to cross the river. The boat can carry the farmer and only one item at a time.thefox cannot be leftonthesameshoreasthegoose,andthegoose cannot be left on the same shore as the sack of corn without the farmer watching them. 7 Collect all facts: Overview of model elements (variables) 2 shores 3 items: Fox Goose Sack of corn 1 farmer in a boat 8 4
5 Collect all facts: Relational constraints on model elements and their values (conditions) One shore is near, one shore is far. Any item and the boat can be only at one shore at a time. The farmer can carry one or none item in the boat. In order to load an item, it must be at the same shore as the boat and the boat must be empty. Goose and fox cannot be at the same shore alone (viz. without farmer). Goose and sack of corn cannot be at the same shore alone (viz. without farmer). The boat can cross the river from near to far shore or vice versa. In the beginning the boat and all items are at the near shore (INIT STATE). In the end the boat and all items are at the far shore (GOAL STATE). 9 Collect all facts: Overview of methods to change model state The boat can cross the river. Items can be loaded and unloaded to the boat. The farmer can judge the criticality of a situtation at a shore. 10 5
6 Reduce the problem to relevant parts in your model Attribute / Elements: Boat Fox Goose Corn Values: Near shore Far shore Methods: Cross the river Load Unload Safe shore? Solution Design 6
7 Perform according to Program Development Process Building up a self contained model of the problem situation: Restate the problem by collecting all facts Reduce the problem to relevant parts Transferring model of problem situation into a desired state systematically: Create a step wise change of the model written as algorithm Document solution approach in a commonly accepted way 13 Decision making and program flow (1/2) The computer executes a sequences of instructions (program) to change data in its main memory (model state). Change of data is done by assignment. Values can be the results of e.g. arithmetic operations (value operator value), use of constants and value copies from other addresses. Address Content of storage cell Comments adr := con 1 Assignment of cell Goose with value 1 (here: 1 represents far shore)... Assignment or assignment statement sets the value (of a variable) stored in a storage cell denoted by an address Storage cell for variable Goose 14 7
8 Decision making and program flow (2/2) Sequences in algorithm or respective program execution can be interrupted by decisions as a result of checking conditions given in the model state. Depending on the outcome of a decision (usually a logical expression, which is evaluated) alternative ways of continuing model state changes are executed. Programs leave sequences based on (un)conditional jumps. Four basic ways of structuring statements (instructions) are considered: Sequence Decision Repetition Procedure Control Structures are ways of structuring statements controlling the order in which the computer executes statements. 15 Program control structures (1/4) Sequence a series of statements that are executed one after another. 16 8
9 Program control structures (2/4) Decision or selection (branch) is a conditional control structure, which executes different statements and thus yields alternative program flows depending on logical evaluation of certain conditions. 17 Program control structures (3/4) Repetition or iteration (loop) is a repetitive control structure, which repeats statements while certain conditions are met. 18 9
10 Program control structures (4/4) Procedure or subprogram (method) allows to structure the program by breaking it into smaller pieces and assemble them into the final form. 19 Flowchart A diagram that represents an algorithm Illustrates a step-wise solution to a given problem Arrows showing flow of control Notation Description Activity: a processing step, which can consist of several statements. Decision: where based on evaluating a condition (commonly a YES NO question) the algorithm continues in executing the respective branch. Input/Output: Information is received or send to user. Start/End State: Total of values the algorithm starts or ends with
11 Flowchart for calculating the absolute value Calculating the absolute value (or modulus) n of a real number n is the non-negative value of n without regard to its sign. The absolute value of a number may be thought of as its distance from zero. 21 In the beginning was the GOTO (1/3) -- Example: calculating absolute values in 3AC Address Content of storage cell Comments adr := con 13 Begin of program adr := con if val > 0 then GOTO adr Conditional jump (based on decision) Adr := val * val Simply taking the next instruction the PC points to is one example for an unconditional jump next instruction End of program Storage cell for variable n Storage cell for variable factor 22 11
12 In the beginning was the GOTO (2/3) -- How to make use of identifiers An identifier (id) is a label. In our 3AC example it exchanges the absolute address of a storage cell by a name. Its comparable to an URL of a website. Identifiers do not change the program but its readability. Address Content of storage cell adr := con adr factor := con if val > 0 then GOTO adr Adr := val * val next instruction factor 1 factor 23 In the beginning was the GOTO (3/3) Address Content of storage cell START adr number := con adr factor := con 1 Example for n= if val number > 0 then GOTO adr END adr number := val number * val factor... END... next instruction... number factor
13 Perform according to Program Development Process Building up a self contained model of the problem situation: Restate the problem by collecting all facts Reduce the problem to relevant parts Transferring model of problem situation into a desired state systematically: Create a step wise change of the model written as algorithm Document solution approach in a commonly accepted way 25 Step-by-Step Solution Design Problem-Solving Technique used here: Reduction Approach we use is comparable to Means-Ends Analysis (MEA) in which the solution of a problem can be described by finding a sequence of actions that lead to a desirable goal Reaching the goal depends on building up associations between particular model state changes and methods that will bring these changes about Represented by flowchart 26 13
14 Overview of relevant parts for: How to cross the river? Attribute / Elements: Boat Fox Goose Corn Values: Near shore Far shore Methods: Cross the river Load Unload Safe shore? 27 Creating a flowchart for: How to cross the river? START END INIT STATE GOAL STATE
15 Creating a flowchart for: How to cross the river (1/5) START CURRENT STATE END We cannot END here, all conditions are violated and nothing has been carried over. 29 Creating a flowchart for : How to cross the river? (2/5) START LOAD UNLOAD END CURRENT STATE We cannot END here, since the farmer has to judge which item is safe to carry over
16 Flowchart: How to cross the river? (3/5) START LOAD YES SAFE SHORE? NO CURRENT STATE UNLOAD END We cannot END here, because not all items are carried over to the far shore. 31 Creating a flowchart for: How to cross the river? (3/5) START LOAD YES SAFE? NO YES GOAL STATE? NO CURRENT STATE UNLOAD END We cannot do a simple repetition, otherwise we would undo our advancement towards a solution
17 Final flowchart for: How to cross the river? (5/5) YES START LOAD SAFE? NO Trick: In case of a safe far shore situation return with an empty boat (no items loaded) to near shore, otherwise load critical item and return to near shore. YES SAFE? NO YES UNLOAD GOAL STATE? END NO LOAD UNLOAD 33 Flowchart and Pseudocode START LOAD Pseudocode is a kind of structured English for describing algorithms. YES YES SAFE? UNLOAD GOAL STATE? END NO NO YES SAFE? NO LOAD UNLOAD It allows to focus on the logic of the algorithm, which describes the sequence of instructions to follow represented by control structures such as: Sequence Decision IF THEN ELSE Repetition WHILE DO, REPEAT UNTIL Procedure 34 17
18 Pseudocode for flowchart: How to cross the river? PROCEDURE RowBoatFromNearToFarShore LoadItem PROCEDURE RowBoatFromFarToNearShore REPEAT IF Safe LoadItem THEN CrossTheRiver UNTIL Safe ELSE CrossTheRiver LoadItem UnloadItem CrossTheRiver ENDPROCEDURE UnloadItem ENDIF ENDPROCEDURE START CALL RowBoatFromNeartoFarShore WHILE NotGoalState DO CALL RowBoatFromFarToNearShore CALL RowBoatFromNeartoFarShore ENDWHILE END 35 END of 2nd Lecture 18
Procedural Programming
Procedural Programming Lecture 2 - Summer Semester 2016 Control Structures Flow Charts Faculty of Engineering Institute of Computer Engineering What we know so far... Programming is only one step in program
More informationProcedural Programming & Fundamentals of Programming
Procedural Programming & Fundamentals of Programming Lecture 4 - Summer Semester 2018 & Joachim Zumbrägel Writing a computer program is only one step in the Program Development Process 2 1 What we know
More informationFlowchart & Algorithm
Flowchart & Algorithm 1 What is Algorithm? What is Flowchart? Write down the advantages and disadvantages. Compare them. Flowchart Flowchart is a pictorial or graphical representation of a process. Each
More informationPseudocode. ARITHMETIC OPERATORS: In pseudocode arithmetic operators are used to perform arithmetic operations. These operators are listed below:
Pseudocode There are 3 programming/pseudocode constructs: 1. Sequence: It refers that instructions should be executed one after another. 2. Selection: This construct is used to make a decision in choosing
More informationCNG 140 C Programming. Syllabus. Course Info Fall Semester. Catalog Description
CNG 140 C Programming 2012-2013 Fall Semester Syllabus Course Info Catalog Description Advanced programming with C: Storage and control structures, recursion and programming with dynamic data structures.
More informationMethod & Tools for Program Analysis & Design
Method & Tools for Program Analysis & Design TMB208 Pemrograman Teknik Kredit: 3 (2-3) 1 Programming Logic and Design, Introductory, Fourth Edition 2 1 Programming Methods Based on structures of programming
More informationSNS COLLEGE OF ENGINEERING,
SNS COLLEGE OF ENGINEERING, COIMBATORE Department of Computer Science and Engineering QUESTION BANK(PART A) GE8151 - PROBLEM SOLVING AND PYTHON PROGRAMMING TWO MARKS UNIT-I 1. What is computer? Computers
More informationCPSC 3740 Programming Languages University of Lethbridge. Control Structures
Control Structures A control structure is a control statement and the collection of statements whose execution it controls. Common controls: selection iteration branching Control Structures 1 15 Howard
More informationA Quick Review of Chapter 1
A Quick Review of Chapter 1 The core of computing is algorithms Algorithm A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts
More informationControl Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur
Control Structures Code can be purely arithmetic assignments At some point we will need some kind of control or decision making process to occur C uses the if keyword as part of it s control structure
More informationCSC 121 Spring 2017 Howard Rosenthal
CSC 121 Spring 2017 Howard Rosenthal Agenda To be able to define computer program, algorithm, and highlevel programming language. To be able to list the basic stages involved in writing a computer program.
More informationChapter Two: Program Design Process and Logic
Chapter Two: Program Design Process and Logic 2.1 Chapter objectives Describe the steps involved in the programming process Understand how to use flowchart symbols and pseudocode statements Use a sentinel,
More informationBIL101E: Introduction to Computers and Information systems Lecture 8
BIL101E: Introduction to Computers and Information systems Lecture 8 8.1 Algorithms 8.2 Pseudocode 8.3 Control Structures 8.4 Decision Making: Equality and Relational Operators 8.5 The if Selection Structure
More informationComputers and FORTRAN Language Fortran 95/2003. Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes. Topics:
Computers and FORTRAN Language Fortran 95/2003 Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes Topics: - Program Design - Logical Operators - Logical Variables - Control Statements Any FORTRAN program
More informationAlgorithm: 1. Introduction
Algorithm 1 Algorithm: a finite set of instructions that specify a sequence of operations to be carried out in order to solve a specific problem or class of problems. [Zwass] Properties of algorithms:
More informationIDENTIFY WAYS OF REPRESENTING ALGORITHMS.
IDENTIFY WAYS OF REPRESENTING ALGORITHMS. OBJECTIVES: Identify ways of representing algorithms: Content Representation of algorithms as Pseudocode or Flowcharts; use of flow chart symbols: input/output
More informationSOEE1160: Computers and Programming in Geosciences Semester /08. Dr. Sebastian Rost
SOEE1160 L3-1 Structured Programming SOEE1160: Computers and Programming in Geosciences Semester 2 2007/08 Dr. Sebastian Rost In a sense one could see a computer program as a recipe (this is pretty much
More informationIntroduction. Computers, algorithms
Introduction Computers, algorithms Computer mathematical engine that processes programs and data it uses some physical principle, for example: mechanical computers Pascal electronic computers after the
More informationCHAPTER : 9 FLOW OF CONTROL
CHAPTER 9 FLOW OF CONTROL Statements-Statements are the instructions given to the Computer to perform any kind of action. Null Statement-A null statement is useful in those case where syntax of the language
More informationControl Structures. Lecture 4 COP 3014 Fall September 18, 2017
Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls
More informationCHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++
CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,
More informationProgramming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester
Programming Language Control Structures: Selection (switch) Eng. Anis Nazer First Semester 2018-2019 Multiple selection choose one of two things if/else choose one from many things multiple selection using
More informationCSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 1 Edgardo Molina Fall 2013 City College of New York 1 Introduction to Computing Lectures: Tuesday and Thursday s (2-2:50 pm) Location: NAC 1/202 Recitation:
More informationCS 199 Computer Programming. Spring 2018 Lecture 2 Problem Solving
CS 199 Computer Programming Spring 2018 Lecture 2 Problem Solving ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence
More informationPROBLEM SOLVING AND PYTHON PROGRAMMING
ALGORITHM UNIT-1 It is defined as a sequence of instructions that describe a method for solving a problem. In other words it is a step by step procedure for solving a problem. Properties of Algorithms
More informationIntroduction. C provides two styles of flow control:
Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if
More informationK Hinds Section No.2 Problem-Solving and Program Design12
Section No.2 Problem-Solving and Program Design12 Problem Solving To model a program with utility to a problem, we need to implement a number of processes prior to actually writing any code in any programming
More informationFLOW CHART AND PSEUDO CODE
FLOW CHART AND PSEUDO CODE Flowchart A Flowchart is a pictorial representation of an algorithm. The First flowchart is made by John Von Newman in 1945. It is a symbolic diagram of operation sequence, dataflow,
More informationIntroduction to C/C++ Lecture 3 - Program Flow Control
Introduction to C/C++ Lecture 3 - Program Flow Control Rohit Sehgal Nishit Majithia Association of Computing Activities, Indian Institute of Technology,Kanpur rsehgal@cse.iitk.ac.in nishitm@cse.iitk.ac.in
More informationSlide 1. Slide 2. Slide 3. General Problem-Solving. Find the Weight of the Block. General_Problem_Solving_slides.docx 9/7/07 MET 107
Slide 1 General Problem-Solving MET 107 Slide 2 General problem-solving techniques Set aside some time to think about the problem before starting. Draw a sketch of the problem. Understand the overall purpose
More informationCS 199 Computer Programming. Spring 2018 Lecture 5 Control Statements
CS 199 Computer Programming Spring 2018 Lecture 5 Control Statements Control Structures 3 control structures Sequence structure Programs executed sequentially by default Branch structure Unconditional
More informationLecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now)
18 100 Lecture 20: AVR Programming, Continued S 15 L20 1 James C. Hoe Dept of ECE, CMU April 2, 2015 Today s Goal: You will all be ace AVR hackers! Announcements: Midterm 2 can be picked up in lab and
More information2.2 (a) Statement, subroutine, procedure, function, parameter, loop
Chapter 2.2: The structure of procedural programs 2.2 (a) Statement, subroutine, procedure, function, parameter, loop Procedural programs are ones in which instructions are executed in the order defined
More informationDecision Making -Branching. Class Incharge: S. Sasirekha
Decision Making -Branching Class Incharge: S. Sasirekha Branching The C language programs presented until now follows a sequential form of execution of statements. Many times it is required to alter the
More informationProgramming Logic & Pseudocode. Python Bootcamp, Day 1 Anna Rosen
Programming Logic & Pseudocode Python Bootcamp, Day 1 Anna Rosen Programming 101 Computer programming involves having the user formulate commands that the computer can run for a specific purpose. The computer
More informationECOR Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.
It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means: Complete the midterm in 1.5 hour(s). Work on your own. Keep your notes and textbook closed. Attempt every question.
More informationStructure Array 1 / 50
Structure Array A structure array is a data type that groups related data using data containers called fields. Each field can contain any type of data. Access data in a structure using dot notation of
More informationCOMSC-051 Java Programming Part 1. Part-Time Instructor: Joenil Mistal
COMSC-051 Java Programming Part 1 Part-Time Instructor: Joenil Mistal Chapter 5 5 Controlling the Flow of Your Program Control structures allow a programmer to define how and when certain statements will
More informationPROGRAM DESIGN TOOLS. Algorithms, Flow Charts, Pseudo codes and Decision Tables. Designed by Parul Khurana, LIECA.
PROGRAM DESIGN TOOLS Algorithms, Flow Charts, Pseudo codes and Decision Tables Pseudo-Code Pseudo-code is another programming tool that is used for planning the program. The word pseudo means imitation
More informationLECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE
Department of Software The University of Babylon LECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE By Dr. Samaher Hussein Ali Collage of Information Technology, University of Babylon, Iraq Samaher_hussein@yahoo.com
More informationProgramming for Problem Solving 105A L T P Credit Major Minor Total Time
ES- Programming for Problem Solving 105A L T P Credit Major Minor Total Time Test Test 3 - - 3 75 25 100 3h Purpose To familiarize the students with the basics of Computer System and C Programming Course
More informationAQA Decision 1 Algorithms. Section 1: Communicating an algorithm
AQA Decision 1 Algorithms Section 1: Communicating an algorithm Notes and Examples These notes contain subsections on Flow charts Pseudo code Loops in algorithms Programs for the TI-83 graphical calculator
More informationUnderstanding the problem
2.1.1 Problem solving and design An algorithm is a plan, a logical step-by-step process for solving a problem. Algorithms are normally written as a flowchart or in pseudocode. The key to any problem-solving
More informationProgramming Logic and Design Seventh Edition
Programming Logic and Design Seventh Edition Chapter 3 Understanding Structure Objectives In this chapter, you will learn about: The disadvantages of unstructured spaghetti code The three basic structures
More informationChapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action.
Chapter 5 Conditional and Iterative Statements Statement Statement are the instructions given to the computer to perform any kind of action. Types of Statement 1. Empty Statement The which does nothing.
More informationPython review. 1 Python basics. References. CS 234 Naomi Nishimura
Python review CS 234 Naomi Nishimura The sections below indicate Python material, the degree to which it will be used in the course, and various resources you can use to review the material. You are not
More informationCOS 598C - Advanced Compilers
Lecture 4: Control Flow Optimization COS 598C Advanced Compilers Reducible Flow Graphs!"# $ &## bb1 Nonreducible! bb2 bb3 Back to Loops Assembly Generation Schema for (i=x; i
More informationA Beginner s Guide to Programming Logic, Introductory
A Beginner s Guide to Programming Logic, Introductory Chapter 3 Understanding Structure Objectives In this chapter, you will learn about: The features of unstructured spaghetti code The three basic structures
More informationProblem Solving Footer Text 10/30/2015 1
Problem Solving Footer Text 10/30/2015 1 Learning Outcome List five (5) steps in problem solving Identify input, process and output from a given problem. 8.2.2 Define algorithm. Solve a given problem using
More informationComputer Architecture
Boaz Kantor Introduction to Computer Science, Fall semester 2009-2010 IDC Herzliya Computer Architecture I know what you're thinking, 'cause right now I'm thinking the same thing. Actually, I've been thinking
More informationREPETITION CONTROL STRUCTURE LOGO
CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of
More informationCSC 111 Introduction to Computer Science (Section C)
CSC 111 Introduction to Computer Science (Section C) Course Description: (4h) Lecture and laboratory. Rigorous introduction to the process of algorithmic problem solving and programming in a modern programming
More informationTHINK LIKE CREATIVE PROBLEM SOLVING V. ANTON SPRAUL
THINK LIKE A PROGRAMMERA A N I N T R O D U C T I O N T O CREATIVE PROBLEM SOLVING V. ANTON SPRAUL CODE EAT SLEEP CONTENTS IN DETAIL ACKNOWLEDGMENTS xi INTRODUCTION xiii About This Book... xv Prerequisites...
More informationCS32 - Week 2. Umut Oztok. July 1, Umut Oztok CS32 - Week 2
CS32 - Week 2 Umut Oztok July 1, 2016 Arrays A basic data structure (commonly used). Organize data in a sequential way. Arrays A basic data structure (commonly used). Organize data in a sequential way.
More informationProgramming Logic and Design Sixth Edition
Objectives Programming Logic and Design Sixth Edition Chapter 4 Making Decisions In this chapter, you will learn about: Evaluating Boolean expressions to make comparisons The relational comparison operators
More informationProgramming Fundamentals - A Modular Structured Approach using C++ By: Kenneth Leroy Busbee
1 0 1 0 Foundation Topics 1 0 Chapter 1 - Introduction to Programming 1 1 Systems Development Life Cycle N/A N/A N/A N/A N/A N/A 1-8 12-13 1 2 Bloodshed Dev-C++ 5 Compiler/IDE N/A N/A N/A N/A N/A N/A N/A
More information5. Control Statements
5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements
More informationIntroduction to Computer Programming/Handout 01 Page 1 of 13
Introduction to Computer Programming/Handout 01 Page 1 of 13 Table of Contents Table of Contents... 1 Learning Objectives... 2 Program... 2 Programmer... 2 Programming Language... 2 Types of Languages...
More informationSNS COLLEGE OF ENGINEERING
SNS COLLEGE OF ENGINEERING DEPARTMENT OF CSE Presented By Thillaiarasu.N SCRAMBLE 2 Solution 3 What is Pseudocode? 4 Consists of: Short Readable Formally styled English language Used for: Explaining the
More information6. Control Statements II
Visibility Declaration in a block is not visible outside of the block. 6. Control Statements II Visibility, Local Variables, While Statement, Do Statement, Jump Statements main block int main () int i
More informationConditions, logical expressions, and selection. Introduction to control structures
Conditions, logical expressions, and selection Introduction to control structures 1 Flow of control In a program, statements execute in a particular order By default, statements are executed sequentially:
More informationPROBLEM SOLVING AND OFFICE AUTOMATION. A Program consists of a series of instruction that a computer processes to perform the required operation.
UNIT III PROBLEM SOLVING AND OFFICE AUTOMATION Planning the Computer Program Purpose Algorithm Flow Charts Pseudo code -Application Software Packages- Introduction to Office Packages (not detailed commands
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing
More informationSpring 2013 CSE Qualifying Exam Core Subjects. March 23, 2013
Spring 2013 CSE Qualifying Exam Core Subjects March 23, 2013 1 Architecture 1. ROB trace - single issue (a) Non-pipelined functional units Assume the following: Nine ROB slots. 1 integer Execution unit,
More informationControl Flow and Loops. Steven R. Bagley
Control Flow and Loops Steven R. Bagley Introduction Started to look at writing ARM Assembly Language Saw the structure of various commands Load (LDR), Store (STR) for accessing memory SWIs for OS access
More informationWilliam Paterson University of New Jersey Department of Computer Science College of Science and Health Course Outline
William Paterson University of New Jersey Department of Computer Science College of Science and Health Course Outline I. Course Title: CS 280 Computer and Assembler Language 3 credits II. III. IV. Course
More informationModule 4: Decision-making and forming loops
1 Module 4: Decision-making and forming loops 1. Introduction 2. Decision making 2.1. Simple if statement 2.2. The if else Statement 2.3. Nested if Statement 3. The switch case 4. Forming loops 4.1. The
More informationHigher Computing Science Software Design and Development - Programming Summary Notes
Higher Computing Science Software Design and Development - Programming Summary Notes Design notations A design notation is the method we use to write down our program design. Pseudocode is written using
More informationProblem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 18 Switch Statement (Contd.) And Introduction to
More informationClass 8 ALGORITHMS AND FLOWCHARTS. The City School
Class 8 ALGORITHMS AND FLOWCHARTS ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence of steps that describe solution
More informationChapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1
Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to
More informationUNIT-II. Part-2: CENTRAL PROCESSING UNIT
Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:
More informationChapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Fourth Edition
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Fourth Edition Objectives In this chapter, you will learn about Representing algorithms Examples of algorithmic problem
More informationSteps to program development
Automate processes - Programming Concepts and Design Steps to program development A computer program is a set of formal instructions, which the computer executes in order to carry out some designated task.
More informationCHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042
CHAPTER 2 PROBLEM SOLVING TECHNIQUES Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 Software Engineering vs Problem Solving Software Engineering - A branch of Computer Science & provides
More informationControl Structures in Java if-else and switch
Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2016 February 2, 2016 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions
More informationProgramming Languages Third Edition
Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand
More informationLab 3. The Art of Assembly Language (II)
Lab. The Art of Assembly Language (II) Dan Bruce, David Clark and Héctor D. Menéndez Department of Computer Science University College London October 2, 2017 License Creative Commons Share Alike Modified
More informationCPSC 213. Introduction to Computer Systems. Readings for Next 2 Lectures. Loops (S5-loop) Control Flow. Static Control Flow. Unit 1d.
Readings for Next 2 Lectures Textbook CPSC 213 Condition Codes - Loops 3.6.1-3.6.5 Introduction to Computer Systems Unit 1d Static Control Flow Control Flow 1 Loops (S5-loop) 2 The flow of control is the
More informationTABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3. Algorithm Design & Problem Solving. Programming. Databases
2 CHAPTER 1 Algorithm Design & Problem Solving 3 CHAPTER 2 Programming 4 CHAPTER 3 Databases TABLE OF CONTENTS 1. ALGORITHM DESIGN & PROBLEM-SOLVING 1.1 Problem-solving & Design Every computer system is
More informationFoundation Exam - Sample Problems for New Topics
Foundation Exam - Sample Problems for New Topics Fall 2016 Dynamic Memory Allocation Sample Question #1 Consider the following struct to store a single Uno playing card: typedef struct char color[20];
More informationComputer Architecture
Boaz Kantor Introduction to Computer Science, Fall semester 2010-2011 IDC Herzliya Computer Architecture I know what you're thinking, 'cause right now I'm thinking the same thing. Actually, I've been thinking
More informationCS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2013
CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2013 YOUR NAME AND ID NUMBER: YOUR ID: ID TO RIGHT: ROW: NO. FROM RIGHT: The exam will begin on the next page. Please, do not turn the page until told.
More information1) Which of the following is an example of a programming language? 1) A) Microsoft Word B) English C) HTML D) Java
FALL 07-08 CIS105(CP105)/CE205 MIDTERM-2 EXAM /FACULTY OF ECON. &ADMIN. SCIENCES OF EUL Student Registration No: Instructor: Prof.Dr.Hüseyin Oğuz Student Name-Surname: Dept. of Computer Information Systems
More informationFlow Chart. The diagrammatic representation shows a solution to a given problem.
low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation
More information(Not Quite) Minijava
(Not Quite) Minijava CMCS22620, Spring 2004 April 5, 2004 1 Syntax program mainclass classdecl mainclass class identifier { public static void main ( String [] identifier ) block } classdecl class identifier
More informationFlow Control. CSC215 Lecture
Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements
More informationPDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs
PDS Lab Section 16 Autumn-2017 Tutorial 3 C Programming Constructs This flowchart shows how to find the roots of a Quadratic equation Ax 2 +Bx+C = 0 Start Input A,B,C x B 2 4AC False x If 0 True B x 2A
More informationITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University
ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 03: Program Development Life Cycle Readings: Not Covered in Textbook Program Development
More informationOrganisation. Assessment
Week 1 s s Getting Started 1 3 4 5 - - Lecturer Dr Lectures Tuesday 1-13 Fulton House Lecture room Tuesday 15-16 Fulton House Lecture room Thursday 11-1 Fulton House Lecture room Friday 10-11 Glyndwr C
More informationSt. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5
Computing Science Software Design & Development (Part 1 Computer Programming) National 5 VARIABLES & DATA TYPES Variables provide temporary storage for information that will be needed while a program is
More informationComputer System and programming in C
Approaches to Problem Solving Concept of algorithm and flow charts ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence
More informationITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University
ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 08: Control Statements Readings: Chapter 6 Control Statements and Their Types A control
More informationLecture 6. Statements
Lecture 6 Statements 1 Statements This chapter introduces the various forms of C++ statements for composing programs You will learn about Expressions Composed instructions Decision instructions Loop instructions
More informationPROGRAMMING CONCEPTS
ch01.qxd 9/19/02 9:17 AM Page 1 C H A P T E R 1 PROGRAMMING CONCEPTS CHAPTER OBJECTIVES In this Chapter, you will learn about: The Nature of a Computer Program and Programming Languages Page 2 Good Programming
More informationAlgorithms, Part 2 of 3. Problem Solving. Problem Solving (con t) Topics Problem Solving Examples Pseudocode Control Structures
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode Control Structures Reading Section 3.3-3.10 (don t worry about understanding the C code, just the pseudocode) Problem Solving Decode this
More informationIS 0020 Program Design and Software Tools
1 IS 0020 Program Design and Software Tools Introduction to C++ Programming Spring 2005 Lecture 1 Jan 6, 2005 Course Information 2 Lecture: James B D Joshi Tuesdays/Thursdays: 1:00-2:15 PM Office Hours:
More informationAlgorithms, Part 2 of 3. Topics Problem Solving Examples Pseudocode Control Structures
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode Control Structures 1 Problem Solving Decode this sentence: Pdeo eo pda yknnayp wjosan. We have just come up with a specific solution to
More informationx = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0
6 Statements 43 6 Statements The statements of C# do not differ very much from those of other programming languages. In addition to assignments and method calls there are various sorts of selections and
More informationReadings for This Lecture
Lecture 4 Classes Readings for This Lecture Section 1.4, 1.5 in text Section 3.1 in text Plive activities referenced in the text Please look at lecture summaries online Handouts are short version Presentation
More information