# Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

Save this PDF as:

Size: px
Start display at page:

Download "Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4."

## Transcription

1 Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A Peter Lo I154-1-A Peter Lo Arithmetic Expression Using Arithmetic Expression Calculations can be performed with variables, constants, properties of certain objects, and numeric literals Do not use strings in calculations Values from Text property of Text Boxes Are strings, even if they contain numeric data Must be converted to a numeric data type before performing a calculation I154-1-A Peter Lo I154-1-A Peter Lo

2 Using Calculations in Code Perform calculations in assignment statements What appears on right side of assignment operator is assigned to item on left side Assignment operators = assign += add and assign -= sub and assign *= multiply and assign /= divide and assign \= integer division and assign ^= power and assign &= append and assign E.g. a = a + 2 a += 2 a = a - 2 a -= 2 a = a * 2 a *= 2 a = a / 2 a /= 2 a = a \ 2 a \= 2 a = a ^ 2 a ^= 2 a = a & 2 a &= 2 Type Conversion TryParse and Convert I154-1-A Peter Lo I154-1-A Peter Lo Data Type Conversion Using the Convert Class String Integer Convert class: Contains methods for converting numeric values to specific data types Use the dot member access operator to separate the class name from the method name Commonly used methods of the Convert class include: ToDouble ToDecimal ToInt32 ToString I154-1-A Peter Lo I154-1-A Peter Lo

3 How to use Convert Class? Using the TryParse Method TryParse method Exist in every numeric data type s class Used to convert a string to that numeric data type Basic syntax of TryParse method has two arguments: String: string value to be converted Variable: location to store the result If TryParse conversion is successful, the method stores the value in the variable. Otherwise, a 0 is stored in the numeric variable I154-1-A Peter Lo I154-1-A Peter Lo How to Use TryParse Method? Option for Compiler Checking The Visual Basic compiler provides several options for checking your code at compile time. Option Explicit determines whether variables must be explicitly declared. Option Strict determines whether explicit narrowing conversions and late binding are allowed. Option Infer enables type inference for member-level (local) variables. Option Compare specifies the method that is used for string comparisons: binary (case-sensitive) or text (caseinsensitive). I154-1-A Peter Lo I154-1-A Peter Lo

4 Option Explicit When Option Explicit is turned off, you can use any variable name without first declaring it. In VB.NET the Option Explicit is turned on by default for all new projects. All variables are declared before being used. When Option Explicit is turned on, you must declare both var1 and var2 before writing var1 = var2 + 1 Option Strict You must use the statement Option Strict On in projects to ensure that: All variables are declared prior to use Data conversions are not done from a wider type to a narrower type E.g. a decimal number 5.43 is not automatically converted to an integer 5 Option Strict does not allow any implicit conversions from a wider data type to a narrower one or between String and numeric data types. I154-1-A Peter Lo I154-1-A Peter Lo Option Infer Option Infer Off statement ensures that every variable is declared with a data type Option Infer Off warns if a variable declaration does not include a data type Setting for Option Explicit, Option Infer & Option Strict by Configuration Open the project properties dialog box and select Compile tab page. By default: Option Explicit and Option Infer is turned on Option Strict is turned off. I154-1-A Peter Lo I154-1-A Peter Lo

5 Setting for Option Explicit, Option Infer & Option Strict by Programming Rules and Examples of Type Conversion Option statements entered in the General Declarations section I154-1-A Peter Lo I154-1-A Peter Lo Relational Operators Relational and Logical Operators Relational operators are binary they require an operand on both sides of the operator Result of a relational expression will always be Boolean They are evaluated from left to right with no order of operations Compound Decision I154-1-A Peter Lo I154-1-A Peter Lo

6 Logical Operators Used for joining Boolean expressions Not makes a False condition True and vice versa And will yield a True if and only if both expressions are True Or will yield a True if one or the other or both expressions are True Example To test if n falls between 2 and 5: (2 < n ) And ( n < 5 ) A complete relational expression must be on either side of the logical operators And and Or. The following is NOT a valid way to test if n falls between 2 and 5: (2 < n < 5 ) I154-1-A Peter Lo I154-1-A Peter Lo Order of Operations The order of operations for evaluating Boolean expressions is: Arithmetic Operators Parenthesis Exponentiation Division and multiplication Addition and subtraction Relational Operators Logical Operators Not And Or I154-1-A Peter Lo Control Structures Sequence, Selection and Iteration Structure I154-1-A Peter Lo

7 Control Structure Three types of control structure, derived from structured programming: Sequences of instructions Selection of alternative instructions (or groups of instructions) Iteration (repetition) of instructions (or groups of instructions) The Sequence Structure Directs computer to process program instructions in a particular order Set of step-by-step instructions that accomplish a task I154-1-A Peter Lo I154-1-A Peter Lo The Selection Structure The Iteration Structure Also called the Decision Structure, Makes a decision and then takes appropriate action based on that decision Used every time you drive your car and approach an intersection Directs computer to repeat one or more instructions until some condition is met Also referred to as a Loop, Repeating or Iteration I154-1-A Peter Lo I154-1-A Peter Lo

8 If Then Else Block Decision If Then Else / Select Case I154-1-A Peter Lo Programs need to do different things in response to different conditions. The If...Then statement allows you to evaluate a condition and to then run different sections of code based on the results of that condition. Will be executed if condition is True Will be executed if condition is False If condition Then action1 Else action2 End If If condition Then action1 End If Statement 2 Statement 3 Regardless of whether the condition in the If statement is True or False, these statements will be executed I154-1-A Peter Lo Workflow for If Then Else Block ElseIf Block I154-1-A Peter Lo An extension of the If block allows for more than two possible alternatives with the inclusion of ElseIf clauses. There is no space between the word "Else" and "If and only one "End If" is required. If condition1 Then action1 ElseIf condition2 Then action2 ElseIf condition3 Then action3 Else action4 End If I154-1-A Peter Lo

9 Simplified Nested If Statement Select Case Terminology When one If block is contained inside another If block, the structure is referred to as nested If blocks. Care should be taken to make If blocks easy to understand. If cond1 Then If cond1 And cond2 Then If cond2 Then action action End If End If End If Nested If Less Confusing I154-1-A Peter Lo A decision-making structure that simplifies choosing among several actions. Avoids complex nested If constructs. If blocks make decisions based on the truth value of a condition; Select Case choices are determined by the value of an expression called a Selector. Select Case Selector Selector Case Value1 Action1 Case Value2 to Value3 Action 2 Case Else Action of last resort End Select Value Lists I154-1-A Peter Lo Workflow for Select Case Block Rules for Select Case Case Else (and its action) is optional Each value list contains one or more of the following types of items separated by commas: A literal; A variable; An expression; An inequality sign preceded by Is and followed by a literal, variable, or expression; A range expressed in the form a To b, where a and b are literals, variables, or expressions. I154-1-A Peter Lo I154-1-A Peter Lo

10 Do Loop Type of Do Loop Explanation Example Iteration Pre Test Loop / Pro Test Loop / For Loop Do While Loop Do Until... Loop Do... Loop While Do... Loop Until The Do While... Loop evaluates the condition, and if the condition is true, then it evaluates the statements following the condition. When it has finished doing this, it evaluates the condition again and if the condition is true, it evaluates the statements again. It continues repeating this process until the condition is false. The Do Until... Loop is similar to the Do While... Loop except it keeps evaluating the statements until the condition is true rather than while it is true. The Do... Loop While evaluates the statements only once. It then evaluates the condition, and if the condition is true, evaluates the statements again. This process continues until the condition is false. Similar to Do... Loop While except that it evaluates the statements until the condition is true. Do While condition statements Loop Do Until condition statements Loop Do statements Loop While condition Do statements Loop Until condition I154-1-A Peter Lo I154-1-A Peter Lo Pre Test Loops Workflow for Pre Test Loop A loop is one of the most important structures in programming. Used to repeat a sequence of statements a number of times. The Do loop repeats a sequence of statements either as long as or until a certain condition is true. Do While / Until condition statement(s) Loop Condition is tested. If it is True, the loop is run. If it is False, the statements following the Loop statement are executed. These statements are inside the body of the loop and are run if the condition above is True. I154-1-A Peter Lo I154-1-A Peter Lo

11 Example for Pre Test Loop Post Test Loop I154-1-A Peter Lo A Do statement precedes the sequence of statements, and a Loop statement follows the sequence of statements. The condition, preceded by either the word While or the word Until, follows the word Do or the word Loop. Be careful to avoid infinite loops loops that never end. VB.NET allows for the use of either the While keyword or the Until keyword at the top or the bottom of a loop. Do statement(s) Loop Until / While condition Loop is executed once and then the condition is tested. If it is False, the loop is run again. If it is True, the statements I154-1-A Peter Lo following the Loop statement are executed. Workflow for Post Test Loop Example for Post Test Loop I154-1-A Peter Lo I154-1-A Peter Lo

12 For Next Loops You can use a For...Next loop when a section of code is to be executed an exact number of times For Next loops enable you to evaluate a sequence of statements multiple times. For and Next statements must be paired and a counter is used to control the loop Start, Stop, and Step values Consider a loop beginning with For i = m To n Step s. The loop will be executed exactly once if m equals n no matter what value s has. The loop will not be executed at all if m is greater than n and s is positive, or if m is less than n and s is negative. I154-1-A Peter Lo I154-1-A Peter Lo Altering the Control Variable Example for For Next Loop The value of the control variable should not be altered within the body of the loop; doing so might cause the loop to repeat indefinitely or have an unpredictable number of repetitions. Non-integer step values can lead to round-off errors with the result that the loop is not executed the intended number of times. I154-1-A Peter Lo I154-1-A Peter Lo

13 Generating Random Integers Creating Random Number The Random Function Pseudo-random number generator: a device that produces a sequence of numbers that meets certain statistical requirements for randomness Random object: represents a pseudo-random number generator Random.Next method: Generates a random integer Can specify a minimum and maximum value I154-1-A Peter Lo I154-1-A Peter Lo How to Generate a Random Number? I154-1-A Peter Lo

### SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS

Add your company slogan SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS Computer Programming (YPG) LOGO 306.1 Review Selected Programming Environment 306.1.1 Explain the concept of reserve words,

### Microsoft Visual Basic 2015: Reloaded

Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Three Memory Locations and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named constants

Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All for repetition statement do while repetition statement switch multiple-selection statement break statement continue statement Logical

### Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

### OBJECT ORIENTED SIMULATION LANGUAGE. OOSimL Reference Manual - Part 1

OBJECT ORIENTED SIMULATION LANGUAGE OOSimL Reference Manual - Part 1 Technical Report TR-CSIS-OOPsimL-1 José M. Garrido Department of Computer Science Updated November 2014 College of Computing and Software

### CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

### CS106X Handout 03 Autumn 2012 September 24 th, 2012 Getting Started

CS106X Handout 03 Autumn 2012 September 24 th, 2012 Getting Started Handout written by Julie Zelenski, Mehran Sahami, Robert Plummer, and Jerry Cain. After today s lecture, you should run home and read

### BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

BoredGames Language Reference Manual A Language for Board Games Brandon Kessler (bpk2107) and Kristen Wise (kew2132) 1 Table of Contents 1. Introduction... 4 2. Lexical Conventions... 4 2.A Comments...

### Quick Reference Guide

SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

### You will have mastered the material in this chapter when you can:

CHAPTER 6 Loop Structures OBJECTIVES You will have mastered the material in this chapter when you can: Add a MenuStrip object Use the InputBox function Display data using the ListBox object Understand

CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

### SECTION II: LANGUAGE BASICS

Chapter 5 SECTION II: LANGUAGE BASICS Operators Chapter 04: Basic Fundamentals demonstrated declaring and initializing variables. This chapter depicts how to do something with them, using operators. Operators

### GBIL: Generic Binary Instrumentation Language. Language Reference Manual. By: Andrew Calvano. COMS W4115 Fall 2015 CVN

GBIL: Generic Binary Instrumentation Language Language Reference Manual By: Andrew Calvano COMS W4115 Fall 2015 CVN Table of Contents 1) Introduction 2) Lexical Conventions 1. Tokens 2. Whitespace 3. Comments

### Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

### Chapter 4 The If Then Statement

The If Then Statement Conditional control structure, also called a decision structure Executes a set of statements when a condition is true The condition is a Boolean expression For example, the statement

CHAD Language Reference Manual INTRODUCTION The CHAD programming language is a limited purpose programming language designed to allow teachers and students to quickly code algorithms involving arrays,

### Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program Objectives After studying this chapter, you should be able to: Include the selection structure in pseudocode

### Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls

### ARG! Language Reference Manual

ARG! Language Reference Manual Ryan Eagan, Mike Goldin, River Keefer, Shivangi Saxena 1. Introduction ARG is a language to be used to make programming a less frustrating experience. It is similar to C

### Petros: A Multi-purpose Text File Manipulation Language

Petros: A Multi-purpose Text File Manipulation Language Language Reference Manual Joseph Sherrick js2778@columbia.edu June 20, 2008 Table of Contents 1 Introduction...................................................

### Programming in Python 3

Programming in Python 3 Programming transforms your computer from a home appliance to a power tool Al Sweigart, The invent with Python Blog Programming Introduction Write programs that solve a problem

### Information Science 1

Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting

### FRAC: Language Reference Manual

FRAC: Language Reference Manual Justin Chiang jc4127 Kunal Kamath kak2211 Calvin Li ctl2124 Anne Zhang az2350 1. Introduction FRAC is a domain-specific programming language that enables the programmer

### Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators

Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

### Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals

### VB FUNCTIONS AND OPERATORS

VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols

### Java Primer 1: Types, Classes and Operators

Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

### In Fig. 3.5 and Fig. 3.7, we include some completely blank lines in the pseudocode for readability. programs into their various phases.

Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 2: Sentinel-Controlled Repetition In Fig. 3.5 and Fig. 3.7, we include some completely blank lines in the pseudocode for readability.

### The Warhol Language Reference Manual

The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

Assoc. Prof. Dr. Marenglen Biba Before writing a program to solve a problem, have a thorough understanding of the problem and a carefully planned approach to solving it. Understand the types of building

### Sprite an animation manipulation language Language Reference Manual

Sprite an animation manipulation language Language Reference Manual Team Leader Dave Smith Team Members Dan Benamy John Morales Monica Ranadive Table of Contents A. Introduction...3 B. Lexical Conventions...3

### Chapter 8 Statement-Level Control Structures

Chapter 8 Statement-Level Control Structures In Chapter 7, the flow of control within expressions, which is governed by operator associativity and precedence rules, was discussed. This chapter discusses

### More Programming Constructs -- Introduction

More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

### 9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement

Outline Expression Evaluation and Control Flow In Text: Chapter 6 Notation Operator evaluation order Operand evaluation order Overloaded operators Type conversions Short-circuit evaluation of conditions

### C++ Programming: From Problem Analysis to Program Design, Fourth Edition. Chapter 4: Control Structures I (Selection)

C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 4: Control Structures I (Selection) Objectives In this chapter, you will: Learn about control structures Examine relational

### C++ 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

### Selec%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

### BASIC OPERATORS AND FUNCTIONS

4 BASIC OPERATORS AND FUNCTIONS Chapter 3 covers the use of isolated constants and variables in a CL procedure. This chapter explains the various manipulations you can perform in CL to combine two or more

### Department of Computer Science COMP The Programming Competency Test

The Australian National University Faculty of Engineering & Information Technology Department of Computer Science COMP1120-2003-01 The Programming Competency Test 1 Introduction The purpose of COMP1120

### Chapter 4 C Program Control

1 Chapter 4 C Program Control Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 2 Chapter 4 C Program Control Outline 4.1 Introduction 4.2 The Essentials of Repetition

### Scheme Quick Reference

Scheme Quick Reference COSC 18 Fall 2003 This document is a quick reference guide to common features of the Scheme language. It is not intended to be a complete language reference, but it gives terse summaries

### Object Oriented Programming with Visual Basic.Net

Object Oriented Programming with Visual Basic.Net By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend (c) Copyright 2007 to 2015 H. Hakimzadeh 1 What do we need to learn in order

### Control Structures. Control Structures Conditional Statements COMPUTER PROGRAMMING. Electrical-Electronics Engineering Dept.

EEE-117 COMPUTER PROGRAMMING Control Structures Conditional Statements Today s s Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical

### Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

### CSE 452: Programming Languages. Outline of Today s Lecture. Expressions. Expressions and Control Flow

CSE 452: Programming Languages Expressions and Control Flow Outline of Today s Lecture Expressions and Assignment Statements Arithmetic Expressions Overloaded Operators Type Conversions Relational and

Sir Muhammad Naveed Arslan Ahmed Shaad (1163135 ) Muhammad Bilal ( 1163122 ) www.techo786.wordpress.com CHAPTER: 2 NOTES:- VARIABLES AND OPERATORS The given Questions can also be attempted as Long Questions.

### Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

### Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++

Repetition Contents 1 Repetition 1.1 Introduction 1.2 Three Types of Program Control Chapter 5 Introduction 1.3 Two Types of Repetition 1.4 Three Structures for Looping in C++ 1.5 The while Control Structure

### Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires

### Introduction to C# Applications

1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

### Lesson 02 Working with Data Types. MIT 31043: VISUAL PROGRAMMING By: S. Sabraz Nawaz Senior Lecturer in MIT

Lesson 02 Working with Data Types MIT 31043: VISUAL PROGRAMMING Senior Lecturer in MIT Variables A variable is a storage location in memory that is represented by a name. A variable stores data, which

### IEEE LANGUAGE REFERENCE MANUAL Std P1076a /D3

LANGUAGE REFERENCE MANUAL Std P1076a-1999 2000/D3 Clause 10 Scope and visibility The rules defining the scope of declarations and the rules defining which identifiers are visible at various points in the

### Chapter 12 Variables and Operators

Chapter 12 Variables and Operators Highlights (1) r. height width operator area = 3.14 * r *r + width * height literal/constant variable expression (assignment) statement 12-2 Highlights (2) r. height

### LESSON 5 FUNDAMENTAL DATA TYPES. char short int long unsigned char unsigned short unsigned unsigned long

LESSON 5 ARITHMETIC DATA PROCESSING The arithmetic data types are the fundamental data types of the C language. They are called "arithmetic" because operations such as addition and multiplication can be

### SMURF Language Reference Manual Serial MUsic Represented as Functions

SMURF Language Reference Manual Serial MUsic Represented as Functions Richard Townsend, Lianne Lairmore, Lindsay Neubauer, Van Bui, Kuangya Zhai {rt2515, lel2143, lan2135, vb2363, kz2219}@columbia.edu

### Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the

### A First Program - Greeting.cpp

C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout

### The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

### Chapter 6 Primitive types

Chapter 6 Primitive types Lesson page 6-1. Primitive types Question 1. There are an infinite number of integers, so it would be too ineffient to have a type integer that would contain all of them. Question

### Learning the Language - V

Learning the Language - V Fundamentals We now have locations to store things so we need a way to get things into those storage locations To do that, we use assignment statements Deja Moo: The feeling that

### APCS Semester #1 Final Exam Practice Problems

Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester

### CA4003 Compiler Construction Assignment Language Definition

CA4003 Compiler Construction Assignment Language Definition David Sinclair 2017-2018 1 Overview The language is not case sensitive. A nonterminal, X, is represented by enclosing it in angle brackets, e.g.

### L-System Fractal Generator: Language Reference Manual

L-System Fractal Generator: Language Reference Manual Michael Eng, Jervis Muindi, Timothy Sun Contents 1 Program Definition 3 2 Lexical Conventions 3 2.1 Comments...............................................

### COSC 122 Computer Fluency. Iteration and Arrays. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency Iteration and Arrays Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) A loop repeats a set of statements multiple times until some

### UNIT 3

UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

### Java Programming Fundamentals. Visit for more.

Chapter 4: Java Programming Fundamentals Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.)

### Twister: Language Reference Manual

Twister: Language Reference Manual Manager: Anand Sundaram (as5209) Language Guru: Arushi Gupta (ag3309) System Architect: Annalise Mariottini (aim2120) Tester: Chuan Tian (ct2698) February 23, 2017 Contents

### Lecture 1. Types, Expressions, & Variables

Lecture 1 Types, Expressions, & Variables About Your Instructor Director: GDIAC Game Design Initiative at Cornell Teach game design (and CS 1110 in fall) 8/29/13 Overview, Types & Expressions 2 Helping

### Information Science 1

Topics covered Information Science 1 Terms and concepts from Week 8 Simple calculations Documenting programs Simple Calcula,ons Expressions Arithmetic operators and arithmetic operator precedence Mixed-type

### Day05 A. Young W. Lim Sat. Young W. Lim Day05 A Sat 1 / 14

Day05 A Young W. Lim 2017-10-07 Sat Young W. Lim Day05 A 2017-10-07 Sat 1 / 14 Outline 1 Based on 2 Structured Programming (2) Conditions and Loops Conditional Statements Loop Statements Type Cast Young

### Lesson 3: Basic Programming Concepts

3 ICT Gaming Essentials Lesson 3: Basic Programming Concepts LESSON SKILLS After completing this lesson, you will be able to: Explain the types and uses of variables and operators in game programming.

### Lecture 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

### HTML5 and CSS3 More JavaScript Page 1

HTML5 and CSS3 More JavaScript Page 1 1 HTML5 and CSS3 MORE JAVASCRIPT 3 4 6 7 9 The Math Object The Math object lets the programmer perform built-in mathematical tasks Includes several mathematical methods

### Repetition Structures

Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

### Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7 Expressions and Assignment Statements ISBN 0-321-33025-0 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

### RTL Reference 1. JVM. 2. Lexical Conventions

RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's

### TED Language Reference Manual

1 TED Language Reference Manual Theodore Ahlfeld(twa2108), Konstantin Itskov(koi2104) Matthew Haigh(mlh2196), Gideon Mendels(gm2597) Preface 1. Lexical Elements 1.1 Identifiers 1.2 Keywords 1.3 Constants

### Computer Programming CS F111

Computer Programming CS F111 BITS Pilani Dubai Campus NAND KUMAR Basics of C Programming BITS Pilani Dubai Campus Write a program that 1. Asks 5 marks from the user, find the average of the marks and print

### MR Language Reference Manual. Siyang Dai (sd2694) Jinxiong Tan (jt2649) Zhi Zhang (zz2219) Zeyang Yu (zy2156) Shuai Yuan (sy2420)

MR Language Reference Manual Siyang Dai (sd2694) Jinxiong Tan (jt2649) Zhi Zhang (zz2219) Zeyang Yu (zy2156) Shuai Yuan (sy2420) 1 MR Language Reference Manual 1. Introduction 1.1 Concept of MapReduce

### Chapter 2 Elementary Programming

Chapter 2 Elementary Programming Part I 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical

### function [s p] = sumprod (f, g)

Outline of the Lecture Introduction to M-function programming Matlab Programming Example Relational operators Logical Operators Matlab Flow control structures Introduction to M-function programming M-files:

### LECTURE 3 C++ Basics Part 2

LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use

### Chapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like?

Chapter 3 - Simple JavaScript - Programming Basics Lesson 1 - JavaScript: What is it and what does it look like? PP presentation JavaScript.ppt. Lab 3.1. Lesson 2 - JavaScript Comments, document.write(),

### CSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU

CSE101-lec#12 Designing Structured Programs Introduction to Functions Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Designing structured programs in C: Counter-controlled repetition

### Language Reference Manual

TAPE: A File Handling Language Language Reference Manual Tianhua Fang (tf2377) Alexander Sato (as4628) Priscilla Wang (pyw2102) Edwin Chan (cc3919) Programming Languages and Translators COMSW 4115 Fall

### SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

### B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

### Fall 2017 Discussion 7: October 25, 2017 Solutions. 1 Introduction. 2 Primitives

CS 6A Scheme Fall 207 Discussion 7: October 25, 207 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write

### Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

### Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

EE 3610: Digital Systems 1 Lecture 3: Modeling in VHDL VHDL: Overview 2 VHDL VHSIC Hardware Description Language VHSIC=Very High Speed Integrated Circuit Programming language for modelling of hardware

### Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE

### Decision Making in C

Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed

### Oracle Database: SQL and PL/SQL Fundamentals Ed 2

Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

### MODULE 02: BASIC COMPUTATION IN JAVA

MODULE 02: BASIC COMPUTATION IN JAVA Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment

### Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

CG39-28 CONTENTS TABLE OF CONTENTS SECTION AND TITLE PAGE 1.0 INTRODUCTION... 1-1 1.1 DESCRIPTION... 1-1 1.2 RELATED LITERATURE... 1-2 2.0 EXPRESSIONS... 2-1 3.0 STATEMENTS... 3-1 3.1 DECLARATION STATEMENTS...

### cs1114 REVIEW of details test closed laptop period

python details DOES NOT COVER FUNCTIONS!!! This is a sample of some of the things that you are responsible for do not believe that if you know only the things on this test that they will get an A on any