1 © 2002 John Urrutia. All rights reserved. Qbasic Chapter 4 IF Statements and READ & DATA.

Slides:



Advertisements
Similar presentations
3. S/E with Control Structures 3.1 Relational Operators and Expressions 3.2 If and if-else Statements 3.3 The Type Double 3.4 Program Design with the While.
Advertisements

Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program.
Pascal Programming Today Chapter 4 1 »Conditional statements allow the execution of one of a number of possible operations. »Conditional statements include:
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
Slide 1 Summary Two basic concepts: variables and assignments Some C++ practical issues: division rule, operator precedence  Sequential structure of a.
Decisions (Conditional Programming) Chapter 5 (Sec. 5.1 & 5.2)
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection)
true (any other value but zero) false (zero) expression Statement 2
1 Lecture 7:Control Structures I (Selection) Introduction to Computer Science Spring 2006.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
CS 1400 Jan 2007 Chapter 4, sections Relational operators Less than< Greater than> Less than or equal= Equal== Not equal!=
CS 117 Spring 2002 Decision Making Hanly Chapter 3 Friedman-Koffman Chapter 4.
Chapter 4: Control Structures: Selection
Visual C++ Programming: Concepts and Projects
Programming with MATLAB. Relational Operators The arithmetic operators has precedence over relational operators.
CSci 125 Lecture 10 Martin van Bommel. Simple Statements Expression followed by semicolon Assignments total = n1 + n2; Function calls printf(”Hello.\n”);
Computer Science 101 The Boolean System. George Boole British mathematician ( ) Boolean algebra –Logic –Set theory –Circuits –Conditions in if.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 4 Decision Structures and Boolean Logic.
Decision Structures and Boolean Logic
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
Lecture Set 5 Control Structures Part A - Decisions Structures.
1 Conditional statements Dept. of Computer Engineering Faculty of Engineering, Kasetsart University Bangkok, Thailand.
1 © 2000 John Urrutia. All rights reserved. Qbasic Looping Statements & Formatted Output.
PAGES:51-59 SECTION: CONTROL1 : DECISIONS Decisions.
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
1 © 2001 John Urrutia. All rights reserved. Chapter 10 using the Bourne Again Shell.
Selection Boolean What is Boolean ? Boolean is a set with only two values : –true –false true and false are standard identifiers in Pascal, called Boolean.
Computer Science 111 Fundamentals of Programming I Making Choices with if Statements.
Chapter 5 - VB 2005 by Schneider1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
MS3304: Week 6 Conditional statements. Overview The flow of control through a script Boolean Logic Conditional & logical operators Basic decision making.
1 © 2000 John Urrutia. All rights reserved. Qbasic Input, Calculations and Functions.
Programming Fundamental Slides1 Data Types, Identifiers, and Expressions Topics to cover here: Data types Variables and Identifiers Arithmetic and Logical.
Chapter 5 Logic; Got Any?. Flow of Control The order in which the computer executes statements in a program Control Structure A statement used to alter.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X1 Chapter 3 Control Statements.
Programming 1 DCT 1033 Control Structures I (Selection) if selection statement If..else double selection statement Switch multiple selection statement.
Conditional Expression One of the most useful tools for processing information in an event procedure is a conditional expression. A conditional expression.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.
Flow of Control Unless indicated otherwise, the order of statement execution through a method is linear: one after the other in the order they are written.
CONDITIONALS. Boolean values Boolean value is either true or false It is name after the British mathemetician, George Boole who first formulated Boolean.
CIS 020 Assembly Programming Chapter 06 - Comparisons & Logical control Procedures © John Urrutia 2012, All Rights Reserved.5/27/20121.
Copyright 2008 by Pearson Education Building Java Programs Chapter 4 Lecture 4-1: if and if/else Statements reading: 4.2 self-check: #4-5, 7, 10, 11 exercises:
Chapter 2 Programming with PHP Part 2. handle_form.php Script 2.3 on pages 46 cript_02_03/form.html
8. DECISION STRUCTURES Rocky K. C. Chang October 18, 2015 (Adapted from John Zelle’s slides)
TestScore < 80 testScore * 2 >= < w / (h * h) x + y != 2 * (a + b) 2 * Math.PI * radius
Pascal Programming George Boole, a 19 th Century mathematician, is created with true, false logic. A Boolean expression in Pascal will be true or false.
CONTROL STRUCTURES (SELECTION). PROGRAM COMPONENTS  SEQUENCE  Groups Of Sequential Steps  SELECTION  Making Choices  IF-THEN (one way)  IF-THEN-ELSE.
CSE202: Lecture 5The Ohio State University1 Selection Structures.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 2: Control Structures (Selection & Repetition)
Rational Expressions relational operators logical operators order of precedence.
 Type Called bool  Bool has only two possible values: True and False.
Section 3 Review Mr. Crone.
Rational Expressions. relational operators. logical operators
Sequence, Selection, Iteration The IF Statement
Data Types, Identifiers, and Expressions
Topics The if Statement The if-else Statement Comparing Strings
4-1 LOGIC OPERATIONS In Chapter 3 we discussed the fact that data inside a computer is stored as patterns of bits. Logic operations refer to those operations.
JavaScript conditional
Topics The if Statement The if-else Statement Comparing Strings
Computers & Programming Languages
Programming with PHP Part 2
Pages:51-59 Section: Control1 : decisions
Conditional Logic Presentation Name Course Name
Expressions.
Understanding Conditions
Relational Operators.
Pages:51-59 Section: Control1 : decisions
Conditionals.
Presentation transcript:

1 © 2002 John Urrutia. All rights reserved. Qbasic Chapter 4 IF Statements and READ & DATA

2 © 2002 John Urrutia. All rights reserved. Boolean or Logical Expressions Algebra created by George Boole Always evaluates to a binary state  Generally:  1 is TRUE  0 is FALSE

3 © 2002 John Urrutia. All rights reserved. Relational Expressions Single relational operator two operands  <Less than  >Greater than  =Equal to  <=Less than or equal to  >=Greater than or equal to  <>Not equal to

4 © 2002 John Urrutia. All rights reserved. One-way Selection Down the primrose path or another IFy situation.  IF condition THEN statement(s) END IF

5 © 2002 John Urrutia. All rights reserved. Two-way Selection There’s more than one-way to skin a turkey.  IF condition THEN statement(s) ELSE statement(s) END IF

6 © 2002 John Urrutia. All rights reserved. Nested IF Statements IF condition THEN statement(s) ELSE statement(s) END IF ELSE statement(s) END IF

7 © 2002 John Urrutia. All rights reserved. Multi-way Selection IF condition THEN statement(s) ELSEIF condition THEN statement(s) ELSEIF condition THEN statement(s) ELSE statement(s) END IF

8 © 2002 John Urrutia. All rights reserved. Logical Operators Op-1Op-2ANDORXOR True False TrueFalse True FalseTrueFalseTrue False

9 © 2002 John Urrutia. All rights reserved. Operator Precedence Order of evaluation  ^Exponent  + or -Unary (sign)  *, /, \, MODArithmetic , =, <>, =  NOT, AND,Logical operators OR, XOR

10 © 2002 John Urrutia. All rights reserved. DATA & READ statements DATA const, const, const, …  Provides internal storage  Accessed sequentially READ var, var, var, …  Populates variables from DATA RESTORE label  Resets the some or all the DATA