ECE Application Programming

Slides:



Advertisements
Similar presentations
ECE Application Programming Instructor: Dr. Michael Geiger Spring 2012 Lecture 31: PE5.
Advertisements

COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Mathematics for Computing Lecture 4: Algorithms and flowcharts Dr Andrew Purkiss-Trew Cancer Research UK
Chapter 1 Pseudocode & Flowcharts
Introduction to C Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
ITEC113 Algorithms and Programming Techniques
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Chapter 3 Planning Your Solution
Chapter 1 Pseudocode & Flowcharts
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
ECE Application Programming Instructors: Dr. Michael Geiger & Nasibeh Nasiri Fall 2015 Lecture 2: Basic C program structure Data in C: Data types,
Value and Reference Parameters. CSCE 1062 Outline  Summary of value parameters  Summary of reference parameters  Argument/Parameter list correspondence.
Introduction to Programming with RAPTOR
Previously Repetition Structures While, Do-While, For.
Visual Basic Programming
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
CS Class 05 Topics  Selection: switch statement Announcements  Read pages 74-83, ,
The switch Statement.  Occasionally, an algorithm will contain a series of decisions in which a variable or expression is tested separately for each.
Chapter 1 Pseudocode & Flowcharts
Debugging Xin Tong. GDB GNU Project debugger Allows you to see what is going on `inside' another program while it executes or crashed. (Faster than printing.
Introduction to Matlab Module #4 Page 1 Introduction to Matlab Module #4 – Programming Topics 1.Programming Basics (fprintf, standard input) 2.Relational.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
An introduction to the debugger And jGrasp editor-syncrasies (ideosyncrasies)
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
ECE Application Programming
ECE Application Programming
ECE Application Programming
ECE Application Programming
ECE Application Programming
ECE Application Programming
ECE Application Programming
Computer Programming I
Introduction To Flowcharting
ECE Application Programming
Microsoft Visual Basic 2005 BASICS
Visual Basic 6 Programming.
Debuggers.
Chapter 2 - Introduction to C Programming
Pseudocode & Flowcharts
Chapter 2 - Introduction to C Programming
1) C program development 2) Selection structure
Algorithms & Pseudocode & Flowcharts
Chapter 1 Pseudocode & Flowcharts
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2 - Introduction to C Programming
EECE.2160 ECE Application Programming
Debugging Visual Basic Programs
jGRASP editor-syncrasies (idiosyncrasies)
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
Chapter 2 - Introduction to C Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
Algorithms & Pseudocode & Flowcharts
Presentation transcript:

16.216 ECE Application Programming Instructor: Dr. Michael Geiger Spring 2012 PE1: Flowcharts, basic debugging skills

ECE Application Programming: Lecture 6 Lecture outline Announcements/reminders Program 2 due Monday, 2/6 Program 3 to be posted; due 2/13 Today: PE1 Flowchart intro Basic elements Designing flowchart for given problem Converting flowchart into program Debugging Viewing variables in debugger Stepping through program Setting breakpoints 4/15/2017 ECE Application Programming: Lecture 6

ECE Application Programming: Lecture 6 Flowcharts Graphical representation of process Shows all steps and their order In programming, use to organize program before writing code Basic elements Process Terminator (start/end) Input/Output Connector Decision Connector (off page) 4/15/2017 ECE Application Programming: Lecture 6

Example: Quadratic Equation Solver Start Output “Quadratic Equation Solver” Output “Enter A, B, C: ” Input A, B, C 4/15/2017 ECE Application Programming: Lecture 6

Quadratic Equation Solver (cont.) TRUE Output X FALSE DISC=B*B-4*A*C DISC = 0? TRUE Output X FALSE DISC>0? TRUE Output X1,X2 FALSE Output XREAL + XIMAG i XREAL – XIMAG i Done 4/15/2017 ECE Application Programming: Lecture 6

ECE Application Programming: Lecture 6 Exercise: Flowchart Design a flowchart to solve the following: Prompt a user to enter four numbers on a single line, which represent the contents of a 2x2 array After reading the values, your program should print the matrix represented by these values For example, if the user enters “1 2 3 4”, print: 1 2 3 4 Assume all values have the same number of digits Also, calculate the matrix discriminant and print it on a separate line In the example above, discriminant = (1x4) - (2x3) = 4-6 = -2 4/15/2017 ECE Application Programming: Lecture 6

ECE Application Programming: Lecture 6 Flowchart: solution 4/15/2017 ECE Application Programming: Lecture 6

Converting flowchart to program What data are used in the process? Can those data be represented as constants? If not, what variables are needed? How many? What type(s)? How should variables be named? What C statement corresponds to each process step? Input statements: scanf() Output statements: printf() Terminators: start/end of main() function Will generalize later to any function General process steps: basic expressions May need multiple lines of code 4/15/2017 ECE Application Programming: Lecture 6

ECE Application Programming: Lecture 6 Debugging Most IDEs allow ability to view state of program while running through debugger View variable values Execute program: One line at a time (single step) By running until reaching a pre-defined stopping point (breakpoint) Can isolate bugs without altering program Alternate solution: inserting print statements to show program state at various points Disadvantages Inefficient--repeated compilation, must keep adding statements May actually alter operation of other statements 4/15/2017 ECE Application Programming: Lecture 6

Debugger demonstration Demonstration of Visual Studio debugger Variables Watch window Autos window Locals window Single step options Step over Step into/step out Breakpoints Setting breakpoints Running to next breakpoint 4/15/2017 ECE Application Programming: Lecture 6

ECE Application Programming: Lecture 6 Next time Operators 4/15/2017 ECE Application Programming: Lecture 6