Programming Problem solving Debugging

Slides:



Advertisements
Similar presentations
C++ Programming:. Program Design Including
Advertisements

Chapter 15 Debugging. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Debugging with High Level Languages.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
PART 6 Programming 1.Decomposition 2.Three Constructs 3.Counting Example 4.Debugging.
Slide 1CPU Emulator Tutorial This program is part of the software suite that accompanies the book The Digital Core, by Noam Nisan and Shimon Schocken 2003,
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Lesson 5 - Decision Structure By: Dan Lunney
1 Chapter 11 l Basics of Recursion l Programming with Recursion Recursion.
CSE115/ENGR160 Discrete Mathematics 03/03/11 Ming-Hsuan Yang UC Merced 1.
Recursive Algorithms Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Chapter 4 H1 Assembly Language: Part 2. Direct instruction Contains the absolute address of the memory location it accesses. ld instruction:
CHAPTER 2 ANALYSIS OF ALGORITHMS Part 2. 2 Running time of Basic operations Basic operations do not depend on the size of input, their running time is.
Basic Building Blocks of Programming. Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into.
1 Algorithms and Problem Solving. 2 Outline  Problem Solving  Problem Solving Strategy  Algorithms  Sequential Statements  Examples.
Fundamentals of Python: From First Programs Through Data Structures
Fundamentals of Python: First Programs
Introduction to Programming. What is a Program  Set of Instructions that tells the computer what to Do.  Driving force behind the computer  Without.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 17: Recursion.
Department of Computer Science Data Structures Using C++ 2E Chapter 6: Recursion Learn about recursive Definitions Algorithms Functions Explore the base.
Chapter 12Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 12 l Basics of Recursion l Programming with Recursion Recursion.
Lecturer: Dr. AJ Bieszczad Chapter 11 COMP 150: Introduction to Object-Oriented Programming 11-1 l Basics of Recursion l Programming with Recursion Recursion.
Chapter 11Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 11 l Basics of Recursion l Programming with Recursion Recursion.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 17: Recursion.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Chapter 12. Recursion Basics of Recursion Programming with Recursion Computer Programming with JAVA.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Chapter 11Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 11 l Basics of Recursion l Programming with Recursion Recursion.
Structured Programming (4 Credits)
Chapter 6 Programming. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 6-2 Solving Problems using a Computer.
Chapter 15: Recursion. Objectives In this chapter, you will: – Learn about recursive definitions – Explore the base case and the general case of a recursive.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 16: Recursion.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
Chapter 6 Programming l Problem solving l Debugging.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Chapter 15: Recursion. Recursive Definitions Recursion: solving a problem by reducing it to smaller versions of itself – Provides a powerful way to solve.
Chapter 15: Recursion. Objectives In this chapter, you will: – Learn about recursive definitions – Explore the base case and the general case of a recursive.
Introduction to Computing Systems and Programming Programming.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
Chapter 6 Programming Adapted from slides provided by McGraw-Hill Companies Inc., modified by professors at University of Wisconsin-Madison.
Software Development Expansion of topics page 28 in Zelle
About the Presentations
Introduction to Computer Engineering
3rd prep. – 2nd Term MOE Book Questions.
Overview of Computers & Programming Languages
Designing and Debugging Batch and Interactive COBOL Programs
Unit# 9: Computer Program Development
Problem Solving Techniques
Chapter 6 Programming.
Program Flow CSCE 121 J. Michael Moore.
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
Chapter (3) - Looping Questions.
Introduction to Computer Engineering
CPU Emulator Tutorial This program is part of the software suite
Chapter 6 Programming.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 17: Recursion.
Introduction to Computer Engineering
Computer Science Core Concepts
Basics of Recursion Programming with Recursion
ICT Programming Lesson 3:
ICT Gaming Lesson 2.
October 29 Review for 2nd Exam Ask Questions! 4/26/2019
Basic Concepts of Algorithm
COSC121: Computer Systems
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Iteration – While Loops
Introduction to Computer Engineering
Chapter 6 Programming.
Presentation transcript:

Programming Problem solving Debugging Chapter 6 Programming Problem solving Debugging

Problem solving Start with systematic decomposition of problem “top-down” analysis stepwise refinement Algorithms must have properties of: finiteness completeness definiteness computability

Structured programming Three control structures: Sequential This is the default Conditional Branching or decision-making Iteration Loops

Implementing the control structures Sequential Conditional Iterative

Stepwise refinement illustrated Character count algorithm: statement of problem & first level of refinement

Stepwise refinement (cont.) 2nd & 3rd levels

Stepwise refinement (cont.) Final level

Debugging A debugging tool provides (at least) the ability to: Set values to registers & memory locations enter as hex, decimal or binary values Execute instructions one at a time, or in small groups Run will set the program running Step causes a fixed number of instructions to be executed (often used to “single-step” through part of a program) Stop execution when desired Breakpoints allow the user to set points at which execution will halt & wait for a new “Run” instruction Examine the contents of registers and memory locations at any point

Debugging example A program to find the first 1 in a 16-bit word

Debugging example (cont.) Oops! We have an infinite loop! Setting a breakpopint at location x3007 & repeatedly running the code shows that the loop does not trerminate because there is no 1 in the test case number