Program add; {program to add 2 numbers and output the result} uses wincrt; begin write('Enter first number: '); readln(first_num); write('Enter second.

Slides:



Advertisements
Similar presentations
1 Input/Output and Debugging  How to use IO Streams  How to debug programs  Help on coursework.
Advertisements

1 Input/Output and Debugging  How to use IO Streams  How to debug programs.
This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
Introduction to JavaScript Please see speaker notes for additional information!
James Tam Repetition In Pascal In this section of notes you will learn how to have a section of code repeated without duplicating the code.
1 Week 2 Variables, output, and input Semester
Programming Languages: Notes for Class Discussion: V Deena Engel’s class.
Web-based Application Development Lecture 17 March 16, 2006 Anita Raja.
James Tam Loops In Pascal In this section of notes you will learn how to rerun parts of your program without having to duplicate the code.
James Tam Loops In Pascal In this section of notes you will learn how to rerun parts of your program without having to duplicate your code.
Variables, Data Types, & Arithmetic Expressions CSC 1401: Introduction to Programming with Java Lecture 3 Wanda M. Kunkle.
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
TrueBASIC Ch 2 & 3 Sample Problems. What are the errors? (2 total) PRINT "REM" LET REM = 50 reAD currency$, amount DAta "Dollar", 50.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
Arrays After a while. Remember for loops? for(int i = 0; i < 10; i++){ System.out.println(i); } -But what if we are unsure of how many cycles we need?
Python: Modularisation Damian Gordon. Modularisation Remember the prime checker program:
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
My Homepage Welcome to my Homepage! SPOT THE BUG No closing title tag.
David Stotts Computer Science Department UNC Chapel Hill.
IMS 3253: Subroutines 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Procedures Subroutines Parameters –By Value.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Foundation Studies Course M.Montebello Arrays Foundation Studies Course.
Pascal Programming Written by Leung King Yung. Simple Program 1 begin end.
Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
VARIABLES Programmes work by manipulating data placed in memory. The data can be numbers, text, objects, pointers to other memory areas, and more besides.
C++ LANGUAGE TUTORIAL LESSON 1 –WRITING YOUR FIRST PROGRAM.
Debugging, Escape Command, More Math. It’s your birthday!  Write a program that asks the user for their name and their age.  Figure out what their birth.
REVIEW No curveballs this time …. PROBLEM TYPE #1: EVALUATIONS.
Chapter 61 Example : For … To… Step For index = 0 To n Step s lstValues.Items.Add(index) Next Control variable Start value Stop value Amount to add to.
Introduction to Text Based Coding. We’re learning to explore how text based programming works You will display and enter text into a window You will use.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Do you trust the 8 Ball? The 8 Ball always knows.
Department of Electronic & Electrical Engineering Statements Blocks{} Semicolons ; Variables Names keywords Scope.
 To find the numerical value of the expression, simply substitute the variables in the expression with the given number. Evaluate: 2x + 7, if x = 4 Substitute.
JavaScript Variables Like other programming languages, JavaScript variables are a container that contains a value - a value that can be changed/fixed.
JavaScript Errors and Debugging Web Design Sec 6-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Chapter 3 - VB 2008 by Schneider1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
Variables, Types, Operations on Numbers CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Multiplication Timed Tests.
Written by Al.So. Software solutions
Using local variable without initialization is an error.
Chapter 6 Sub Procedures
Solving Linear Systems by Linear Combinations
Please use speaker notes for additional information!
Spot the Mistake – Expanding Double Brackets
Prof. Miguel A. Arce 11th Grade English
Variables Numbers can be stored and retrieved while a program is running if they are given a home. The way that integers and decimal numbers are stored.
Vectors and Matrices I.
What is a run-on? A run-on is a sentence that contains two independent clauses, in other words, a sentence that is really two sentences in one.
Spot the bug!.
Variables, Types, Operations on Numbers
We are starting JavaScript. Here are a set of examples
Variables, Types, Operations on Numbers
Grammar/Mechanics Errors
Core Objects, Variables, Input, and Output
Software Development Process
Our Targets Maths I know my multiplication tables from 2 x to12 x including the inverse and use them to solve mathematical problems. I know my 7, 8, 9.
INC 161 , CPE 100 Computer Programming
See requirements for practice program on next slide.
Dr. Fowler  CCM Patterns & Sequences Now - Next.
YOUR text YOUR text YOUR text YOUR text
Do you trust the 8 Ball? The 8 Ball always knows..
MAKING the SENTENCE: Clauses, Fragments, & Run-Ons
7-2 Multiplying powers with the same base.
Class code for pythonroom.com cchsp2cs
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
Types of Errors And Error Analysis.
CHAPTER 6 Testing and Debugging.
Presentation transcript:

program add; {program to add 2 numbers and output the result} uses wincrt; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG No variable declarations

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG ; No semi colon

program add; program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG { Missing curly bracket

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(first_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Incorrect variable used

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write(Enter first number: ); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG No quotes around text

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end SPOT THE BUG. Missing full stop

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',first_num); end. SPOT THE BUG Incorrect variable used

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ' total); end. SPOT THE BUG, Missing comma

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer second_num : integer total : integer begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG ; ; Missing semi colons ;

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; secon_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Variable names inconsistent

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readl(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Keyword not correct

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; start write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG Incorrect keyword

program add {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total := firstnum + second_num; write('Total: ',total); end. SPOT THE BUG 2 errors

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: ') readln(first_num); write('Enter second number: ') readln(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG 2 errors

program add; {program to add 2 numbers and output the result} uses wincrt; var first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readln(second_num); total = first_num / second_num; write('Total: ',total); end. SPOT THE BUG 2 errors

program add; {program to add 2 numbers and output the result} uses wincrt; va first_num : integer; second_num : integer; total : integer; begin write('Enter first number: '); readln(first_num); write('Enter second number: '); readl(second_num); total := first_num + second_num; write('Total: ',total); end. SPOT THE BUG 2 errors

That’s all folks!