Straight-line code (or IPO: Input-Process-Output) If/else & switch. Relational Expressions. Decisions. Sections 4.1-6, , 4.
|
|
- Clara Gibson
- 6 years ago
- Views:
Transcription
1 If/ese & switch Unit 3 Sections 4.1-6, , CS 1428 Spring 2018 Ji Seaman Straight-ine code (or IPO: Input-Process-Output) So far a of our programs have foowed this basic format: Input some vaues Do some computations Output the resuts The statements are executed in a sequence, first to ast. 1 2 Decisions Sometimes we want to be abe to decide which of two statements to execute: N fee is 2.9% monthy saes > $3,000 Y fee is 2.5% Reationa Expressions Making decisions require being abe to ask Yes or No questions. Reationa expressions aow us to do this. Reationa expressions evauate to true or fase. Aso caed: ogica expressions conditiona expressions booean expressions 3 4
2 Reationa Expressions 4.1 Reationa Operators Booean iteras: Binary operators used to compare expressions: true fase true evauates to true Booean variabes fase evauates to fase < Less than <= Less than or equa to > Greater than >= Greater than or equa to == Equas (note: do not use =)!! boo ispositive = true; boo found = fase;!= Not Equas ispositive evauates to true found evauates to fase 5 6 Reationa Expressions Reationa Operator Precedence Exampes: int x=6; int y=10; a. x == 5 evauates to fase b. 7 <= x + 2 evauates to c. y 3 > x evauates to d. x!= y evauates to d. true evauates to true Reationa operators are LOWER than arithmetic operators: int x, y; x < y -10 // minus happens first x * 5 >= y + 10 // mut, then pus, then >= Can assign reationa expressions to variabes: boo ispositive; int x; cin >> x; ispositive = x > 0; if the user types: 25 ispositive stores the vaue Reationa operators are HIGHER than assignment: int x, y; boo t1 = x > 7; // > then = boo t2 = x * 5 >= y + 10; // *, +, >=, = 7 8
3 4.2 The if statement The if statement can be used to execute a statement ony under certain conditions: if (expression) statement expression is evauated If it is true, then statement is executed. If it is fase, then statement is skipped if statement exampe Exampe: An empoyee gets a $100 bonus if their hours are over 40. doube rate = 14.50; doube hours, pay; cout << Enter the hours you worked: ; cin >> hours; pay = hours * rate; if (hours > 40) pay = pay + 100; cout << Your pay is: $ << pay << end; The bock statement if with a bock a bock (or a compound statement) is a set of statements inside braces: { int x; cout << Enter a vaue for x: << end; cin >> x; cout << Thank you. << end; We can use a bock to conditionay execute more than just one statement: doube rate = 14.50; doube hours, pay; cout << Enter the hours you worked: ; cin >> hours; This groups severa statements into a singe statement. This aows us to use mutipe statements when by rue ony one is aowed. pay = hours * rate; if (hours > 40) { pay = pay + 100; cout << Your pay incudes a bonus. << end; cout << Your pay is: $ << pay << end; 11 12
4 4.4 The if/ese statement if-ese exampe if/ese statement is used to decide which of two statements to execute: if (expression) statement1 (or bock) ese statement2 (or bock) expression is evauated If it is true, then statement1 is executed. (statement2 is skipped). If it is fase, then statement2 is executed (statement1 is skipped). statement1 and statement2 are caed branches 13 doube monthysaes; doube price; doube rate; cout << "Enter monthy saes ast month: " ; cin >> monthysaes; cout << "Enter seing price of item: " ; cin >> price; if (monthysaes > 3000) rate =.025; ese rate =.029; doube commission = price * rate; cout << "Commission: $" << commission << end; Enter monthy saes ast month: 3025 Enter seing price of item: 100 Commission: $ if-ese structure 4.5 Nested if statements Notice: if (monthysaes > 3000) rate =.025; ese rate =.029; reationa expression is in parentheses NO semi-coon after expression, nor the ese Good stye: indent the statements in each branch!! if-ese is a statement. It can occur as a branch of another if-ese statement
5 Nested if statements Nested if statements if-ese is a statement. It can occur as a branch of another if-ese statement. char borninusa; int age; cout << Were you born in the USA (Y/N)?: ; cin >> borninusa; cout << Pease enter your age: ; cin >> age; if (borninusa == 'Y') if (age >= 35) cout << You quaify to run for President\n ; ese cout << You are too young to run for President\n ; ese cout << You must have been born in the US in order << to run for President << end; 17 if-ese is a statement. It can occur as a branch of another if-ese statement. char borninusa; int age; cout << Were you born in the USA (Y/N)?: ; cin >> borninusa; cout << Pease enter your age: ; cin >> age; if (borninusa == 'Y') if (age >= 35) cout << You quaify to run for President\n ; ese cout << You are too young to run for President\n ; ese cout << You must have been born in the US in order << to run for President << end; 18 Testing a series of conditions Common nested if pattern Decision structure to determine a grade 19 Determine etter grade from test score: If we are in this ese branch, what do we know about the vaue of testscore? if (testscore >= 90) grade = 'A'; ese { if (testscore >= 80) grade = 'B'; ese { if (testscore >= 70) grade = 'C'; ese { if (testscore >= 60) grade = 'D'; ese grade = 'F'; Note the braces are actuay optiona here! 20
6 4.6 The if/ese if Statement 4.8 Logica Operators Not reay a different statement, just a different way of indenting the nested if statement from the previous side: if (testscore >= 90) grade = 'A'; ese if (testscore >= 80) grade = 'B'; ese if (testscore >= 70) grade = 'C'; ese if (testscore >= 60) grade = 'D'; ese grade = 'F'; Used to create reationa expressions from other reationa expressions: && AND (binary operator) a && b is true ony when both a and b are true OR (binary operator)! a b is true whenever either a or b is true NOT (unary operator) removed braces, put if ( ) on previous ine!a is true when a is fase eiminated nested indentation Exampes int x=6; int y=10; Logica Operators a. x == 5 && y <= 3 fase && fase is fase b. x > 0 && x < 10 true && true is true c. x == 10 y == 10 fase true is true d. x == 10 x == 11 is e.!(x > 0)!true is f.!(x > 6 y == 10)!(fase true) is boo fag; fag = (x > 0 && x < 25); g.!fag h. fag x < Logica Operator Precedence! is higher than most operators, so use parentheses: && is higher than int x;!(x < 0 && x > -10) // <, >, &&,! int x, y; boo fag; fag x * 5 >= y + 10 && x == 5 // which op is first? second? etc? && and are ower than arithmetic+reationa operators: parens not usuay needed 24
7 4.9 Checking Numeric Ranges We want to know if x is in the range from 1 to 10 (incusive) a. if (1 <= x <= 10) //as in math cass cout << YES << end; //THIS DOES NOT WORK IN C++: // ((1<=x) <=10) (assume x is -5) // => ( fase <= 10) // => ( 0<=10 ) is true, but shoud be fase b. if (1 <= x && x <= 10) cout << YES << end; -check: x=0? (1<=0 && 0<=10) => fase && true -check: x=5? (1<=5 && 5<=10) => true && true -check: x=100? (1<=100 && 100<=10) =>?? Menus Menu-driven program: program controed by user seecting from a ist of actions Menu: ist of choices on the screen Dispay ist of numbered/ettered choices Prompt user to make a seection Test the seection in nested if/ese or switch Match found: execute corresponding code Ese: error message (invaid seection). 26 Sampe menu code 4.11 Vaidating User Input int choice; doube charges; int months = 12; // Dispay the menu and get a choice. cout << "Heath Cub Membership Menu\n\n"; cout << "1. Standard Adut Membership\n"; cout << "2. Chid Membership\n"; cout << "3. Senior Citizen Membership\n"; cout << "Enter your choice: "; cin >> choice; // Respond to the user's menu seection. if (choice==1) { charges = months * 40.0; cout << "The tota charges are $" << charges << end; ese if (choice==2) { charges = months * 20.0; cout << "The tota charges are $" << charges << end; ese if (choice==3) { charges = months * 30.0; cout << "The tota charges are $" << charges << end; ese { cout << ERROR: The vaid choices are 1 through 3. << end; 27 Input vaidation: inspecting input data to determine whether it is acceptabe Invaid input is an error that shoud be treated as an exceptiona case. The program can ask the user to re-enter the data The program can exit with an error message cout << Enter a positive number: ; cin >> x; if (x > 0) { //do something with x here ese { cout << You entered a negative number or 0. << end; cout << The program is ending. << end; 28
8 4.12 Comparing Characters and Strings Comparing string objects Characters are compared using their ASCII vaues A < B This is true. ASCII vaue of 'A' (65) is ess than the ASCII vaue of B (66) 1 < 2 This is true. ASCII vaue of '1' (49) is ess than the ASCI vaue of '2' (50) Like characters, strings are compared using their ASCII vaues string name1 = "Mary"; string name2 = "Mark"; name1 > name2 // true name1 <= name2 // fase name1!= name2 // true The characters in each string must match exacty in order to be equa Otherwise, use first nonequa character as basis of the comparison ( y > k ) Lowercase etters have higher ASCII codes than uppercase etters, so 'a' > 'Z' name1 < "Mary Jane" // true If a string is a prefix of the other, then it is ess than the other The switch statement Like a nested if/ese, used to seect one of mutipe aternative code sections. tests one integer/char expression against mutipe constant integer/char vaues: switch (expression) { case const1: statements case constn: statements defaut: statements switch statement behavior switch (expression) { case const1: statements case constn: statements defaut: statements expression is evauated to an int/char vaue execution starts at the case abeed with that int/char vaue execution starts at defaut if the int/char vaue matches none of the case abes 31 32
9 switch statement syntax switch statement exampe switch (expression) { case const1: statements case constn: statements defaut: statements expression must have int/char type const1, constn must be constants! a itera or named constant statements is one or more statements (braces not needed and not recommended!) defaut: is optiona 33 Exampe: int quarter; switch (quarter) { case 1: cout << First ; case 2: cout << Second ; case 3: cout << Third ; case 4: cout << Fourth ; defaut: cout << Invaid choice ; 34 The break Statement Mutipe abes The break statement causes an immediate exit from the switch statement. if ch is a, it fas through to output Option A (then it breaks) Without a break statement, execution continues on to the next set of statements (the next case). Sometimes this is usefu: the textbook has some nice exampes. char ch; switch (ch) { case a : case A : cout << Option A ; case b : case B : cout << Option B ; case c : case C : cout << Option C ; defaut: cout << Invaid choice ; 35 36
10 4.15 More about bocks and scope The scope of a variabe is the part of the program where the variabe may be used. The scope of a variabe is the innermost bock in which it is defined, from the point of definition to the end of that bock. Note: the body of the main function is just one big bock. 37 Scope of variabes in bocks int main() { doube income; //scope of income is red + bue cout << "What is your annua income? "; cin >> income; if (income >= 35000) { int years; //scope of years is bue; cout << "How many years at current job? "; cin >> years; if (years > 5) cout << "You quaify.\n"; ese cout << "You do not quaify.\n"; Cannot access years ese down here cout << "You do not quaify.\n"; cout << Thanks for appying.\n ; return 0; 38 Variabes with the same name In an inner bock, a variabe is aowed to have the same name as a variabe in the outer bock. When in the inner bock, the outer variabe is not avaiabe (it is hidden). Not good stye: difficut to trace code and find bugs See exampe next side Variabes with the same name int main() { int number; cout << "Enter a number greater than 0: "; cin >> number; if (number > 0) { int number; // another variabe named number cout << "Now enter another number "; cin >> number; cout << "The second number you entered was "; cout << number << end; cout << "Your first number was " << number << end; 39 Enter a number greater than 0: 88 Now enter another number 2 The second number you entered was 2 Your first number was 88 40
Functions. 6.1 Modular Programming. 6.2 Defining and Calling Functions. Gaddis: 6.1-5,7-10,13,15-16 and 7.7
Functions Unit 6 Gaddis: 6.1-5,7-10,13,15-16 and 7.7 CS 1428 Spring 2018 Ji Seaman 6.1 Moduar Programming Moduar programming: breaking a program up into smaer, manageabe components (modues) Function: a
More informationIntro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?
Intro to Programming & C++ Unit 1 Sections 1.1-3 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2018 Ji Seaman 1.1 Why Program? Computer programmabe machine designed to foow instructions Program a set of
More informationIntro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components Illustrated
Intro to Programming & C++ Unit 1 Sections 1.1-3 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Fa 2017 Ji Seaman 1.1 Why Program? Computer programmabe machine designed to foow instructions Program instructions
More information3.1 The cin Object. Expressions & I/O. Console Input. Example program using cin. Unit 2. Sections 2.14, , 5.1, CS 1428 Spring 2018
Expressions & I/O Unit 2 Sections 2.14, 3.1-10, 5.1, 5.11 CS 1428 Spring 2018 Ji Seaman 1 3.1 The cin Object cin: short for consoe input a stream object: represents the contents of the screen that are
More informationl A program is a set of instructions that the l It must be translated l Variable: portion of memory that stores a value char
Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fa 2018 Ji Seaman Programming A program is a set of instructions that the computer foows to perform a task It must be transated from
More informationArrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-3,5
Arrays Unit 5 Gaddis: 7.1-3,5 CS 1428 Spring 2018 Ji Seaman Array Data Type Array: a variabe that contains mutipe vaues of the same type. Vaues are stored consecutivey in memory. An array variabe decaration
More informationArrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-4,6
Arrays Unit 5 Gaddis: 7.1-4,6 CS 1428 Fa 2017 Ji Seaman Array Data Type Array: a variabe that contains mutipe vaues of the same type. Vaues are stored consecutivey in memory. An array variabe definition
More informationSearching, Sorting & Analysis
Searching, Sorting & Anaysis Unit 2 Chapter 8 CS 2308 Fa 2018 Ji Seaman 1 Definitions of Search and Sort Search: find a given item in an array, return the index of the item, or -1 if not found. Sort: rearrange
More informationStructures. Data Types Structures. Data Types (C/C++) Gaddis: A Data Type consists of: Unit 7. example: Integer. CS 1428 Spring 2018
Structures Data Types A Data Type consists of: Unit 7 Gaddis: 11.2-8 set of vaues set of operations over those vaues CS 1428 Spring 2018 Ji Seaman exampe: Integer whoe numbers, -32768 to 32767 +, -, *,
More informationWeek 4. Pointers and Addresses. Dereferencing and initializing. Pointers as Function Parameters. Pointers & Structs. Gaddis: Chapters 9, 11
Week 4 Pointers & Structs Gaddis: Chapters 9, 11 CS 5301 Spring 2017 Ji Seaman 1 Pointers and Addresses The address operator (&) returns the address of a variabe. int x; cout
More informationWeek 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018.
Week 2 Branching & Looping Gaddis: Chapters 4 & 5 CS 5301 Spring 2018 Jill Seaman 1 Relational Operators l relational operators (result is bool): == Equal to (do not use =)!= Not equal to > Greater than
More informationChapter 4: Making Decisions
Chapter 4: Making Decisions 4.1 Relational Operators Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >= Greater than or equal to
More informationChapter 4: Making Decisions
Chapter 4: Making Decisions CSE 142 - Computer Programming I 1 4.1 Relational Operators Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >=
More informationOuterjoins, Constraints, Triggers
Outerjoins, Constraints, Triggers Lecture #13 Autumn, 2001 Fa, 2001, LRX #13 Outerjoins, Constraints, Triggers HUST,Wuhan,China 358 Outerjoin R S = R S with danging tupes padded with nus and incuded in
More informationfile://j:\macmillancomputerpublishing\chapters\in073.html 3/22/01
Page 1 of 15 Chapter 9 Chapter 9: Deveoping the Logica Data Mode The information requirements and business rues provide the information to produce the entities, attributes, and reationships in ogica mode.
More informationInfinity Connect Web App Customization Guide
Infinity Connect Web App Customization Guide Contents Introduction 1 Hosting the customized Web App 2 Customizing the appication 3 More information 8 Introduction The Infinity Connect Web App is incuded
More information5. Selection: If and Switch Controls
Computer Science I CS 135 5. Selection: If and Switch Controls René Doursat Department of Computer Science & Engineering University of Nevada, Reno Fall 2005 Computer Science I CS 135 0. Course Presentation
More informationLECTURE 04 MAKING DECISIONS
PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 04 MAKING DECISIONS
More informationl Tree: set of nodes and directed edges l Parent: source node of directed edge l Child: terminal node of directed edge
Trees & Heaps Week 12 Gaddis: 20 Weiss: 21.1-3 CS 5301 Fa 2016 Ji Seaman 1 Tree: non-recursive definition Tree: set of nodes and directed edges - root: one node is distinguished as the root - Every node
More informationSpecial Edition Using Microsoft Excel Selecting and Naming Cells and Ranges
Specia Edition Using Microsoft Exce 2000 - Lesson 3 - Seecting and Naming Ces and.. Page 1 of 8 [Figures are not incuded in this sampe chapter] Specia Edition Using Microsoft Exce 2000-3 - Seecting and
More informationChapter 4: Making Decisions. Copyright 2012 Pearson Education, Inc. Sunday, September 7, 14
Chapter 4: Making Decisions 4.1 Relational Operators Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >= Greater than or equal to
More informationl A set is a collection of objects of the same l {6,9,11,-5} and {11,9,6,-5} are equivalent. l There is no first element, and no successor of 9.
Sets & Hash Tabes Week 13 Weiss: chapter 20 CS 5301 Spring 2018 What are sets? A set is a coection of objects of the same type that has the foowing two properties: - there are no dupicates in the coection
More informationSearching & Sorting. Definitions of Search and Sort. Other forms of Linear Search. Linear Search. Week 11. Gaddis: 8, 19.6,19.8.
Searching & Sorting Week 11 Gaddis: 8, 19.6,19.8 CS 5301 Fa 2017 Ji Seaman 1 Definitions of Search and Sort Search: find a given item in a ist, return the position of the item, or -1 if not found. Sort:
More informationIBC DOCUMENT PROG007. SA/STA SERIES User's Guide V7.0
IBC DOCUMENT SA/STA SERIES User's Guide V7.0 Page 2 New Features for Version 7.0 Mutipe Schedues This version of the SA/STA firmware supports mutipe schedues for empoyees. The mutipe schedues are impemented
More informationChapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the
More informationFlow of Control. Branching Loops exit(n) method Boolean data type and expressions
Flow of Control Branching Loops exit(n) method Boolean data type and expressions Chapter 3 Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Flow of Control is the execution order
More informationChapter 4 - Notes Control Structures I (Selection)
Chapter 4 - Notes Control Structures I (Selection) I. Control Structures A. Three Ways to Process a Program 1. In Sequence: Starts at the beginning and follows the statements in order 2. Selectively (by
More informationLanguage Identification for Texts Written in Transliteration
Language Identification for Texts Written in Transiteration Andrey Chepovskiy, Sergey Gusev, Margarita Kurbatova Higher Schoo of Economics, Data Anaysis and Artificia Inteigence Department, Pokrovskiy
More informationAn Optimizing Compiler
An Optimizing Compier The big difference between interpreters and compiers is that compiers have the abiity to think about how to transate a source program into target code in the most effective way. Usuay
More informationEnd To End Software Developer Training
Page 1 of 13 Software Deveoper Boot Camp www. End To End Software Deveoper Training C# Training ASP.NET Training Software Deveoper Boot Camp.NET FRAMEWORK Training ADO.NET Training About The Software Deveoper
More informationControl Statements. If Statement if statement tests a particular condition
Control Statements Control Statements Define the way of flow in which the program statements should take place. Implement decisions and repetitions. There are four types of controls in C: Bi-directional
More informationSearching & Sorting. Definitions of Search and Sort. Other forms of Linear Search. Linear Search. Week 11. Gaddis: 8, 19.6,19.8. CS 5301 Spring 2017
Searching & Sorting Week 11 Gaddis: 8, 19.6,19.8 CS 5301 Spring 2017 Ji Seaman 1 Definitions of Search and Sort Search: find a given item in a ist, return the position of the item, or -1 if not found.
More informationMCSE Training Guide: Windows Architecture and Memory
MCSE Training Guide: Windows 95 -- Ch 2 -- Architecture and Memory Page 1 of 13 MCSE Training Guide: Windows 95-2 - Architecture and Memory This chapter wi hep you prepare for the exam by covering the
More informationA Petrel Plugin for Surface Modeling
A Petre Pugin for Surface Modeing R. M. Hassanpour, S. H. Derakhshan and C. V. Deutsch Structure and thickness uncertainty are important components of any uncertainty study. The exact ocations of the geoogica
More informationRegister Allocation. Consider the following assignment statement: x = (a*b)+((c*d)+(e*f)); In posfix notation: ab*cd*ef*++x
Register Aocation Consider the foowing assignment statement: x = (a*b)+((c*d)+(e*f)); In posfix notation: ab*cd*ef*++x Assume that two registers are avaiabe. Starting from the eft a compier woud generate
More informationFlow Control. CSC215 Lecture
Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements
More informationTutorial 3 Concepts for A1
CPSC 231 Introduction to Computer Science for Computer Science Majors I Tutoria 3 Concepts for A1 DANNY FISHER dgfisher@ucagary.ca September 23, 2014 Agenda script command more detais Submitting using
More informationInsert the power cord into the AC input socket of your projector, as shown in Figure 1. Connect the other end of the power cord to an AC outlet.
Getting Started This chapter wi expain the set-up and connection procedures for your projector, incuding information pertaining to basic adjustments and interfacing with periphera equipment. Powering Up
More informationPL/SQL, Embedded SQL. Lecture #14 Autumn, Fall, 2001, LRX
PL/SQL, Embedded SQL Lecture #14 Autumn, 2001 Fa, 2001, LRX #14 PL/SQL,Embedded SQL HUST,Wuhan,China 402 PL/SQL Found ony in the Orace SQL processor (sqpus). A compromise between competey procedura programming
More informationDecisions. Arizona State University 1
Decisions CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 4 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More information4.1. Chapter 4: Simple Program Scheme. Simple Program Scheme. Relational Operators. So far our programs follow a simple scheme
Chapter 4: 4.1 Making Decisions Relational Operators Simple Program Scheme Simple Program Scheme So far our programs follow a simple scheme Gather input from the user Perform one or more calculations Display
More informationl A set is a collection of objects of the same l {6,9,11,-5} and {11,9,6,-5} are equivalent. l There is no first element, and no successor of 9.
Sets & Hash Tabes Week 13 Weiss: chapter 20 CS 5301 Fa 2017 What are sets? A set is a coection of objects of the same type that has the foowing two properties: - there are no dupicates in the coection
More informationV2 2/4/ Ch Programming in C. Flow of Control. Flow of Control. Flow of control The order in which statements are executed
Programming in C 1 Flow of Control Flow of control The order in which statements are executed Transfer of control When the next statement executed is not the next one in sequence 2 Flow of Control Control
More informationTopics. Chapter 5. Equality Operators
Topics Chapter 5 Flow of Control Part 1: Selection Forming Conditions if/ Statements Comparing Floating-Point Numbers Comparing Objects The equals Method String Comparison Methods The Conditional Operator
More informationFlow of Control. Flow of control The order in which statements are executed. Transfer of control
1 Programming in C Flow of Control Flow of control The order in which statements are executed Transfer of control When the next statement executed is not the next one in sequence 2 Flow of Control Control
More informationSoftware Design & Programming I
Software Design & Programming I Starting Out with C++ (From Control Structures through Objects) 7th Edition Written by: Tony Gaddis Pearson - Addison Wesley ISBN: 13-978-0-132-57625-3 Chapter 4 Making
More information3GPP TS V7.1.0 ( )
TS 29.199-7 V7.1.0 (2006-12) Technica Specification 3rd Generation Partnership Project; Technica Specification Group Core Network and Terminas; Open Service Access (OSA); Paray X Web Services; Part 7:
More informationMore Relation Model: Functional Dependencies
More Reation Mode: Functiona Dependencies Lecture #7 Autumn, 2001 Fa, 2001, LRX #07 More Reation Mode: Functiona Dependencies HUST,Wuhan,China 152 Functiona Dependencies X -> A = assertion about a reation
More informationNCH Software Spin 3D Mesh Converter
NCH Software Spin 3D Mesh Converter This user guide has been created for use with Spin 3D Mesh Converter Version 1.xx NCH Software Technica Support If you have difficuties using Spin 3D Mesh Converter
More informationCS 105 Lecture 5 Logical Operators; Switch Statement. Wed, Feb 16, 2011, 5:11 pm
CS 105 Lecture 5 Logical Operators; Switch Statement Wed, Feb 16, 2011, 5:11 pm 1 16 quizzes taken Average: 37.9 Median: 40.5 Quiz 1 Results 16 Scores: 45 45 44 43 43 42 41 41 40 36 36 36 34 31 28 21 Avg
More informationA METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS. A. C. Finch, K. J. Mackenzie, G. J. Balsdon, G. Symonds
A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS A C Finch K J Mackenzie G J Basdon G Symonds Raca-Redac Ltd Newtown Tewkesbury Gos Engand ABSTRACT The introduction of fine-ine technoogies to printed
More informationNearest Neighbor Learning
Nearest Neighbor Learning Cassify based on oca simiarity Ranges from simpe nearest neighbor to case-based and anaogica reasoning Use oca information near the current query instance to decide the cassification
More information5. Control Statements
5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements
More informationRevisions for VISRAD
Revisions for VISRAD 16.0.0 Support has been added for the SLAC MEC target chamber: 4 beams have been added to the Laser System: X-ray beam (fixed in Port P 90-180), 2 movabe Nd:Gass (ong-puse) beams,
More informationIntroduction to the Stack. Stacks and Queues. Stack Operations. Stack illustrated. elements of the same type. Week 9. Gaddis: Chapter 18
Stacks and Queues Week 9 Gaddis: Chapter 18 CS 5301 Spring 2017 Ji Seaman Introduction to the Stack Stack: a data structure that hods a coection of eements of the same type. - The eements are accessed
More informationLecture 3 Tao Wang 1
Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers
More informationChapter Overview. More Flow of Control. Flow Of Control. Using Boolean Expressions. Using Boolean Expressions. Evaluating Boolean Expressions
Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Copyright 2011 Pearson Addison-Wesley. All rights reserved.
More informationSolutions to the Final Exam
CS/Math 24: Intro to Discrete Math 5//2 Instructor: Dieter van Mekebeek Soutions to the Fina Exam Probem Let D be the set of a peope. From the definition of R we see that (x, y) R if and ony if x is a
More informationOther Loop Options EXAMPLE
C++ 14 By EXAMPLE Other Loop Options Now that you have mastered the looping constructs, you should learn some loop-related statements. This chapter teaches the concepts of timing loops, which enable you
More informationExtracting semistructured data from the Web: An XQuery Based Approach
EurAsia-ICT 2002, Shiraz-Iran, 29-31 Oct. Extracting semistructured data from the Web: An XQuery Based Approach Gies Nachouki Université de Nantes - Facuté des Sciences, IRIN, 2, rue de a Houssinière,
More informationChapter 3: Introduction to the Flash Workspace
Chapter 3: Introduction to the Fash Workspace Page 1 of 10 Chapter 3: Introduction to the Fash Workspace In This Chapter Features and Functionaity of the Timeine Features and Functionaity of the Stage
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection) Control Structures A computer can proceed: In sequence Selectively (branch) - making
More informationMCSE TestPrep SQL Server 6.5 Design & Implementation - 3- Data Definition
MCSE TestPrep SQL Server 6.5 Design & Impementation - Data Definition Page 1 of 38 [Figures are not incuded in this sampe chapter] MCSE TestPrep SQL Server 6.5 Design & Impementation - 3- Data Definition
More informationData Management Updates
Data Management Updates Jenny Darcy Data Management Aiance CRP Meeting, Thursday, November 1st, 2018 Presentation Objectives New staff Update on Ingres (JCCS) conversion project Fina IRB cosure at study
More informationIf your PC is connected to the Internet, you should download a current membership data file from the SKCC Web Server.
fie:///c:/users/ron/appdata/loca/temp/~hhe084.htm Page 1 of 54 SKCCLogger, Straight Key Century Cub Inc. A Rights Reserved Version v03.00.11, 24-Oct-2018 Created by Ron Bower, AC2C SKCC #2748S SKCCLogger
More informationLooping. Arizona State University 1
Looping CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 5 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationMeeting Exchange 4.1 Service Pack 2 Release Notes for the S6200/S6800 Servers
Meeting Exchange 4.1 Service Pack 2 Reease Notes for the S6200/S6800 Servers The Meeting Exchange S6200/S6800 Media Servers are SIP-based voice and web conferencing soutions that extend Avaya s conferencing
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationThis is a CLOSED-BOOK-CLOSED-NOTES exam consisting of five (5) questions. Write your answer in the answer booklet provided. 1. OO concepts (5 points)
COMP2012H Object Oriented Programming and Data Structures Spring Semester 2013 Midterm Exam Soution March 26, 2013, 10:30-11:50am in Room 3598 Instructor: Chi Keung Tang This is a CLOSED-OOK-CLOSED-NOTES
More informationAdd Subtract Multiply Divide
ARITHMETIC OPERATORS if AND if/else AND while LOOP Order of Operation (Precedence Part 1) Copyright 2014 Dan McElroy Add Subtract Multiply Divide + Add - Subtract * Multiply / Divide = gives the quotient
More informationChapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 2 C++ Basics 1 Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Slide 2-3 2.1 Variables and Assignments 2
More informationFOR SERVICE TECHNICIAN S USE ONLY
W10600683C Assemby: W10611974 FOR SERVICE TECHNICIAN S USE ONLY NOTE: This sheet contains important Technica Service Data. Tech Sheet Do Not Remove Or Destroy DANGER Eectrica Shock Hazard Ony authorized
More informationChapter 3. Flow of Control. Branching Loops exit(n) method Boolean data type and expressions
Chapter 3 Flow of Control Branching Loops exit(n) method Boolean data type and expressions Chapter 3 Java: an Introduction to Computer Science & Programming - Walter Savitch 1 What is Flow of Control?
More informationRecognize the correct ordering of decisions in multiple branches Program simple and complex decision
Lesson Outcomes At the end of this chapter, student should be able to: Use the relational operator (>, >=,
More informationProfessor: Alvin Chao
Professor: Avin Chao Anatomy of a Java Program: Comments Javadoc comments: /** * Appication that converts inches to centimeters. * * @author Chris Mayfied * @version 01/21/2014 */ Everything between /**
More informationSQL3 Objects. Lecture #20 Autumn, Fall, 2001, LRX
SQL3 Objects Lecture #20 Autumn, 2001 #20 SQL3 Objects HUST,Wuhan,China 588 Objects in SQL3 OQL extends C++ with database concepts, whie SQL3 extends SQL with OO concepts. #20 SQL3 Objects HUST,Wuhan,China
More informationSelection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING MULTIPLE SELECTION To solve a problem that has several selection, use either of the following method: Multiple selection nested
More informationswitch case Logic Syntax Basics Functionality Rules Nested switch switch case Comp Sci 1570 Introduction to C++
Comp Sci 1570 Introduction to C++ Outline 1 Outline 1 Outline 1 switch ( e x p r e s s i o n ) { case c o n s t a n t 1 : group of statements 1; break ; case c o n s t a n t 2 : group of statements 2;
More informationAs Michi Henning and Steve Vinoski showed 1, calling a remote
Reducing CORBA Ca Latency by Caching and Prefetching Bernd Brügge and Christoph Vismeier Technische Universität München Method ca atency is a major probem in approaches based on object-oriented middeware
More informationThe Big Picture WELCOME TO ESIGNAL
2 The Big Picture HERE S SOME GOOD NEWS. You don t have to be a rocket scientist to harness the power of esigna. That s exciting because we re certain that most of you view your PC and esigna as toos for
More informationwhile for do while ! set a counter variable to 0 ! increment it inside the loop (each iteration)
Week 7: Advanced Loops while Loops in C++ (review) while (expression) may be a compound (a block: {s) Gaddis: 5.7-12 CS 1428 Fall 2015 Jill Seaman 1 for if expression is true, is executed, repeat equivalent
More informationunderstood as processors that match AST patterns of the source language and translate them into patterns in the target language.
A Basic Compier At a fundamenta eve compiers can be understood as processors that match AST patterns of the source anguage and transate them into patterns in the target anguage. Here we wi ook at a basic
More informationAvaya Extension to Cellular User Guide Avaya Aura TM Communication Manager Release 5.2.1
Avaya Extension to Ceuar User Guide Avaya Aura TM Communication Manager Reease 5.2.1 November 2009 2009 Avaya Inc. A Rights Reserved. Notice Whie reasonabe efforts were made to ensure that the information
More informationChapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 2 C++ Basics Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style 3 2.1 Variables and Assignments Variables and
More informationChapter 2. C++ Basics
Chapter 2 C++ Basics Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Slide 2-2 2.1 Variables and Assignments Variables
More informationSupporting Top-k Join Queries in Relational Databases
Supporting Top-k Join Queries in Reationa Databases Ihab F. Iyas Waid G. Aref Ahmed K. Emagarmid Department of Computer Sciences, Purdue University West Lafayette IN 47907-1398 {iyas,aref,ake}@cs.purdue.edu
More information2 nd Week Lecture Notes
2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous
More informationBy the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program
1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize
More informationUEE1302(1102) F10: Introduction to Computers and Programming
Computational Intelligence on Automation Lab @ NCTU UEE1302(1102) F10: Introduction to Computers and Programming Programming Lecture 02 Flow of Control (I): Boolean Expression and Selection Learning Objectives
More informationLecture outline Graphics and Interaction Scan Converting Polygons and Lines. Inside or outside a polygon? Scan conversion.
Lecture outine 433-324 Graphics and Interaction Scan Converting Poygons and Lines Department of Computer Science and Software Engineering The Introduction Scan conversion Scan-ine agorithm Edge coherence
More information6 Functions. 6.1 Focus on Software Engineering: Modular Programming TOPICS. CONCEPT: A program may be broken up into manageable functions.
6 Functions TOPICS 6.1 Focus on Software Engineering: Modular Programming 6.2 Defining and Calling Functions 6.3 Function Prototypes 6.4 Sending Data into a Function 6.5 Passing Data by Value 6.6 Focus
More informationDatabases and PHP. Accessing databases from PHP
Databases and PHP Accessing databases from PHP PHP & Databases PHP can connect to virtuay any database There are specific functions buit-into PHP to connect with some DB There is aso generic ODBC functions
More informationBEA WebLogic Server. Release Notes for WebLogic Tuxedo Connector 1.0
BEA WebLogic Server Reease Notes for WebLogic Tuxedo Connector 1.0 BEA WebLogic Tuxedo Connector Reease 1.0 Document Date: June 29, 2001 Copyright Copyright 2001 BEA Systems, Inc. A Rights Reserved. Restricted
More informationChapter Overview. C++ Basics. Variables and Assignments. Variables and Assignments. Keywords. Identifiers. 2.1 Variables and Assignments
Chapter 2 C++ Basics Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Copyright 2011 Pearson Addison-Wesley. All rights
More informationLayout Conscious Approach and Bus Architecture Synthesis for Hardware-Software Co-Design of Systems on Chip Optimized for Speed
Layout Conscious Approach and Bus Architecture Synthesis for Hardware-Software Co-Design of Systems on Chip Optimized for Speed Nattawut Thepayasuwan, Member, IEEE and Aex Doboi, Member, IEEE Abstract
More informationSect 8.1 Lines and Angles
7 Sect 8. Lines and nges Objective a: asic efinitions. efinition Iustration Notation point is a ocation in space. It is indicated by aking a dot. Points are typicay abeed with capita etters next to the
More informationC48C SERIES - 1/16 DIN COUNTERS
RED LION CONTROLS INTERNATIONAL HEADQUARTERS EUROPEAN HEADQUARTERS 0 Wiow Springs Circe, York, Pa. 70, (77) 767-6 FAX: (77) 76-089 89 Pymouth Road, Sough, Berkshire SL LP Web site- http://www.redion-contros.com
More informationCHAPTER : 9 FLOW OF CONTROL
CHAPTER 9 FLOW OF CONTROL Statements-Statements are the instructions given to the Computer to perform any kind of action. Null Statement-A null statement is useful in those case where syntax of the language
More informationDHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++
DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++ Objective: To Learn Basic input, output, and procedural part of C++. C++ Object-orientated programming language
More informationRDF Objects 1. Alex Barnell Information Infrastructure Laboratory HP Laboratories Bristol HPL November 27 th, 2002*
RDF Objects 1 Aex Barne Information Infrastructure Laboratory HP Laboratories Bristo HPL-2002-315 November 27 th, 2002* E-mai: Andy_Seaborne@hp.hp.com RDF, semantic web, ontoogy, object-oriented datastructures
More information