Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program.
Chapter 5 Decisions. Outline and Objectives Relational and Logical Operators If Blocks Select Case Blocks.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
5-1 Flow of Control Recitation-01/25/2008  CS 180  Department of Computer Science  Purdue University.
Week 10 Recap CSE 115 Spring For-each loop When we have a collection and want to do something to all elements of that collection we use the for-each.
2-1 Making Decisions Sample assignment statements PayAmount = Hours * Rate PayAmount = 40*Rate + (Hours – 40)*Rate*1.5.
1 Lecture 7:Control Structures I (Selection) Introduction to Computer Science Spring 2006.
Geography 465 Assignments, Conditionals, and Loops.
- Meeting 5 – Making Decision By: Felix Valentin, MBA.
Control Structures: Selection CE 311 K - Introduction to Computer Methods Daene C. McKinney.
T ODAY ’ S Q UOTE "The computers do what you tell them to do, not what you want them to do. " ( Alexander Atanasov)
CSci 125 Lecture 10 Martin van Bommel. Simple Statements Expression followed by semicolon Assignments total = n1 + n2; Function calls printf(”Hello.\n”);
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
Chapter 3: Data Types and Operators JavaScript - Introductory.
Chapter 4 - VB 2008 by Schneider1 Chapter 4 – Decisions 4.1 Relational and Logical Operators 4.2 If Blocks 4.3 Select Case Blocks.
Chapter 5 - VB 2005 by Schneider1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks 5.3 Select Case Blocks 5.4 A Case Study: Weekly.
Programming Logic and Design, Second Edition, Comprehensive
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.
Chapter 5 Decisions. Outline and Objectives Relational and Logical Operators If Blocks Select Case Blocks.
CONTROL STRUCTURE The if, elseif, and else & switch Statements 1.
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.
Chapter 5 - VB 2005 by Schneider1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks.
1 2. Program Construction in Java. 2.4 Selection (decisions)
Computer Science 1620 boolean. Types so far: Integer char, short, int, long Floating Point float, double, long double String sequence of chars.
Operators Precedence - Operators with the highest precedence will be executed first. Page 54 of the book and Appendix B list C's operator precedence. Parenthesis.
Refer to Ivor Horton’s Beginning ANSI C++ The Complete Language, 3rd Ed. APress Media, LLC. Choices and Decisions if statement if-else statement Relational.
Conditional Expression One of the most useful tools for processing information in an event procedure is a conditional expression. A conditional expression.
1 © 2002 John Urrutia. All rights reserved. Qbasic Chapter 4 IF Statements and READ & DATA.
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students Introduction to branching.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
Chapter 51 Logical Operators Used with Boolean expressions Not – makes a False expression True and vice versa And – will yield a True if and only if both.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
Relational and Boolean Operators CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Lesson 1.4 Equations and Inequalities Goal: To learn how to solve equations and check solutions of equations and inequalities.
Chapter 4 Making Decision Csc 125 C++ programming language Fall 2005.
1 Chapter 4 – Decisions 4.1 Relational and Logical Operators 4.2 If Blocks 4.3 Select Case Blocks 4.4 Input via User Selection.
Expressions and Order of Operations Operators – There are the standard operators: add, subtract, divide, multiply – Note that * means multiply? (No times.
CS 139 – Programming Fundamentals Lecture 08A. Relational/comparison Operators Relational Operator Meaning > is greater than < is less than >= is greater.
3.4 Strings Variables and Strings Using Text Boxes for Input and Output Concatenation ANSI Character Set String Properties and Methods: LengthToUpper TrimToLower.
Chapter 4 - VB 2008 by Schneider1 Chapter 4 – Decisions 4.1 Relational and Logical Operators 4.2 If Blocks 4.3 Select Case Blocks.
1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks 5.3 Select Case Blocks 5.4 A Case Study: Weekly Payroll.
Week 4 Relational and Logical Operators Dr. Jennifer Cunningham.
TUTORIAL 4 Visual Basic 6.0 Mr. Crone. Pseudocode Pseudocode is written language that is part-code part- English and helps a programmer to plan the layout.
Relational Operator and Operations
Chapter 4 - VB 2008 by Schneider
Chapter 4: Making Decisions.
Topics The if Statement The if-else Statement Comparing Strings
Expressions and Control Flow in JavaScript
Chapter 4 – Decisions 4.1 Relational and Logical Operators
Introduction To Robot Decision Making
Topics The if Statement The if-else Statement Comparing Strings
2-1 Making Decisions Sample assignment statements
Relational Operators Operator Meaning < Less than > Greater than
Solving Equations with Variables on Both Sides Day 2
Selection Statements.
Introduction To Robot Decision Making
Conditional Logic Presentation Name Course Name
Expressions.
Chapter 10 Section 4.
The Data Element.
Relational Operators.
Chapter 5 Decisions.
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
The Data Element.
Solving Equations with Variables on Both Sides Day 2
Conditionals.
Presentation transcript:

Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks

Chapter 52 Relational and Logical Operators Relational Operators ANSI Values Logical Operators Boolean Data Type

Chapter 53 Relational Operators <less than <=less than or equal to >greater than >=greater than or equal to =equal to <>not equal to ANSI values are used to decide order for strings.

Chapter 54 ANSI Character Set A numeric representation for every key on the keyboard and for other assorted characters.

Chapter 55 ANSI Character Set: continued A numeric representation for every key on the keyboard and for other assorted characters.

Chapter 56 Chr Function For n between 0 and 255, Chr(n) is the string consisting of the character with ANSI value n. EXAMPLES: Chr(65) is "A" Chr(162) is "¢"

Chapter 57 Asc Function For a string str, Asc(str) is ANSI value of the first character of str. EXAMPLES: Asc("A") is 65 Asc("¢25") is 162

Chapter 58 Boolean Data Type An expression or variable that evaluates to either True or False is said to have Boolean data type. Example: The statement txtBox.Text = (2+3)<6 displays True in the text box.

Chapter 59 Example When a = 3, b = 4 (a + b) < 2 * a = 7 2 * 3 = 6 7 is NOT less than 6 and the value of the expression is False

Chapter 510 Another Example a = 4 b = 3 c = 5 ( c – b ) = ( a / 2 ) 5 – 3 = 2 4 / 2 = 2 True because 2 equals 2

Chapter 511 Relational Operator Notes Relational operators require an operand on both sides of the operator Value of a relational expression will always be True or False Expressions are evaluated from left to right with no order of operations