Moving from C++ to VBA

Size: px
Start display at page:

Transcription

2 Moving from to ME309, L. S. Caretto, Spring 2014 Page 2 #include <iostream> #include <cmath> using namespace std; int main() cout << "Enter the argument, x, to compute exp(x): "; double x; cin >> x; const int maxn = 100; // avoid infinite loop const double maxerror = 1e-12; // desired error bool converged = false; // loop control var double term = 1; // initial exp(x) term double sum = term; // initialize sum int n = 0; // initialize counter while (!converged && n < maxn) // start loop n++; // increment counter term *= x / n; // get new term sum += term; // update partial sum converged = fabs(term) // convergence cond <= maxerror * fabs( sum ); if (converged) // output value cout << "sin(" << x << //if solution is ") = " << sum << "\n"; // converged or // error message else cout << "No convergence\n"; return EXIT_SUCCESS; Option Explicit Sub getexpx() Dim x As Double x = InputBox("Enter x to compute exp(x)") Const maxn As Integer = 100 Const maxerror As Double = 1e-12 Dim converged As Boolean converged = False Dim term As Double term = 1 Dim sum As Double sum = term Dim n As Integer n = 0 Avoid infinite loop desired error loop control variable General series term Running series sum Do While (Not converged And n < maxn) Loop n = n + 1 term = term * x / n sum = sum + term converged = Abs(term) <= _ maxerror * Abs(sum) If converged Then Else End If End Sub MsgBox "exp(" & x & ") = " & sum MsgBox "No convergence in getexpx" Convergence condition

3 Moving from to ME309, L. S. Caretto, Spring 2014 Page 3 Declaring variables Declaration statements in start with the variable type and several variables can be assigned the same type in a single statement; e.g., double x, y, z Declaration statements in start with the word Dim followed by the variable name followed by the keyword As followed by the data type. Although several variables can be declared in one statement, the data types must be repeated for each variable. Two examples are shown below. Dim x As Double, y as double, z As Double Dim s As String, k As Integer, R As Double Operators The following arithmetic and relational operations are the same in and : + * < <= => and >. Also both languages use the equal sign as the assignment operator (x = y + z). In the forward slash division operator (/) always produces a real result, even if the two operands are integers. To get integer division in one has to use the backslash operator (\). In there is only one division operator, the forward slash. It produces a real result if either the numerator or denominator is real. If both the numerator and denominator are integer, the result is an integer. The following operators are different in the two languages. The third entry (fourth column) shows the string concatenation operator, an & in and a + in. (The + can also be used in.) Compute x y Misc Relational equal/not equal Logical Operators pow(x,y) & + ==!= &&! x^y Mod & = <> And Or Not The combination operators (++, --, +=, -=, /=, *=, etc.) do not exist in. Procedures In, there are only function procedures. In there are two types of procedures: functions and subs. A sub procedure in is like a void function in ; neither returns a value to the calling program through the procedure name. functions return a value to the program that calls the function by setting the function name equal to a value. functions use a return statement in the function to return a value to the program that calls them. Because all procedures are functions, there is no need to use the word function in the function header. The pattern for a function header <function type> <function name> ( <argument list> ) The argument list for a function consist of zero or more entries like the following <data type> <variable name> When there is more than one variable in the argument list, all variables, except the last one, are followed by commas. Examples of function headers are shown below: bool leap( int year ) int getvalidint( int xmin, int xmax, string name ) The header for a function is shown below: Function <function name> ( <argument list> ) As <function type> The argument list for a function consist of zero or more entries like the following <variable name> As <data type> Like the argument list in, when there is more than one variable in the argument list, all variables, except the last one, are followed by commas. The function headers that would be used in place of the function headers shown above are given below:

4 Moving from to ME309, L. S. Caretto, Spring 2014 Page 4 Function leap( year As Long ) As Boolean Function getvalidint(xmin As Long, xmax As Long, name As String ) As Long The full code for a function that inputs a year and returns true if the year is a leap year (or false if it is not) is shown below for (on the left) and. bool leap( int year) return ( year % 4 == 0 ) && ( year % 100!= 0 ) ( year % 400 == 0 ); Passing function parameters by value or by reference Function leap( year As Long ) As _ Boolean leap = ( year Mod 4 = 0 ) And ( year Mod 100 <> 0) Or ( year Mod 400 = 0 ) End Function There are two ways to pass a variable to a function (or sub in ). The first, known as pass-byreference, is to pass the memory location of the variable. In this case any changes to the corresponding variable in the function (or sub) take place in the corresponding variable in the calling program. In the alternative, pass-by-value, only the value of the variable in the calling program is passed to the function (or sub). Any changes to the variable in the function (or sub) do not affect the corresponding variable in the calling program. In the default is pass-by- value; in the default is pass-by-reference. These defaults and the changes required to obtain the alternative as compared in the table below. Pass-by-value bool f(double x) Function bool (ByVal x as Double) as Boolean Pass-by-reference bool f (double& x) Function bool ( x as Double) as Boolean If else if statements There are several minor differences between these choice statements in and as shown in the comparison below. In both languages the final else block is optional. if (<condition1>) <statements done if condition1 is true> else if ( <condition2> ) <statements done if condition2 is true> else if ( <condition3> ) <statements done if condition3 is true> <other possible else if statements> else <statements done if all conditions false> The conditions are placed in parentheses. The word then is not used after the conditions. Statements are placed in braces. Use two separate words: else if There is no end if. The words if and else must be lower case. Count-controlled looping If <condition1> Then <statements done if condition1 is true> ElseIf <condition2> Then <statements done if condition2 is true> ElseIf <condition3> Then <statements done if condition3 is true> <other possible ElseIf statements> Else <statements done if all conditions false> End If The conditions are not placed in parentheses. The word Then is used after the conditions. Statements are not placed in braces. ElseIf is one word. An End If is required. The words else, if elseif and end can be typed in any case; the editor will format them as shown. Both and use a for loop, but there is no direct comparison because the for loop in is much more powerful (and more complex) than the one in. The comparison below shows the for loop and its equivalent in. The general structures are shown in the first row and the two code versions for a specific example are shown in the second row.

5 Moving from to ME309, L. S. Caretto, Spring 2014 Page 5 for ( <index> = <start>; <index> <= <end>; <index>+=<increment> ) <loop statements that can use index> for (k = 1; k <= 10; k += 2) cout >> k >> endl; cout >> 2 * k >> endl;. Conditional looping For <index> = <start> To <end> Step <increment> <loop statements that can use index> Next <index> For k = 1 to 10 Step 2 msgbox k msgbox 2 * k Next k has more forms of conditional looping than. Both have loops on while conditions where the loop continues so long as the condition is true. also has a loop on an until condition in which the loop continues while the condition is false. Each language has two while loops. One starts with a test and will not be executed if the condition is false at the start of the loop. The other has its test at the end of the loop so that the loop code will always execute at least once. These two loops are compared below. Arrays while ( <condition> ) <loop statements > do <loop statements > while ( <condition> ); Do While <condition> < loop statements > Loop Do < loop statements > Loop While <condition> The basic notational differences between different array types are shown in the table below. Notation for one-dimensional arrays A[k] A(k) Notation for two-dimensional arrays A[k][m] A(k,m) Default lowest subscript 0 0 (or Option Base 1) Can redefine lowest subscript for each array No Yes The size of an array is declared in the same statements used to declare a variable. An example of this in is: double x(10), b(10), A(10,10). Note that the number 10 in this example represents the number of elements in the array. The array index runs from 0 to 9. The same statement in, assuming the default minimum subscript of zero, is: Dim x(9) as Double, b(9) as Double, A(9,9) as Double. Note that in the dimension information represents the maximum subscript. can redefine the default minimum subscript as one by placing the statement, Option Base 1, in the declarations section of the module. can also specify both the minimum and maximum subscript for each array by a statement of the following form: Dim y(2 To 7) as Double, B(3 to 8, -9 To -4) As Double. Passing arrays to functions is compared in the table below. The use of the global variable, LIM, is required in to maintain consistency in array dimensions between the calling program and the function. It is not required in. In both the and statements below the array index can run from 0 to 9. This is the difference between the practice of setting the number of array component in the dimension information and the practice of setting the maximum subscript in the dimension information. Global variable const int LIM = 10 const LIM as Long = 9 Calling program int a[lim]; int b[lim][lim]; f = fun(a, b); Dim a(0 to LIM) As Double Dim b(0 To LIM,0To LIM) As Double f = fun(a,b) Function header Int f( int a[], int b[][lim] ) Function f ( A() As Long, B() ) As Long

VB.NET Programming Fundamentals

Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

Lecture 2 Notes: Flow of Control

6.096 Introduction to C++ January, 2011 Massachusetts Institute of Technology John Marrero Lecture 2 Notes: Flow of Control 1 Motivation Normally, a program executes statements from first to last. The

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be...

What is a Loop? CSC Intermediate Programming Looping A loop is a repetition control structure It causes a single statement or a group of statements to be executed repeatedly It uses a condition to control

6. Control Structures

- 35 - Control Structures: 6. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose,

Conditions & Boolean Expressions

Conditions & Boolean Expressions 1 In C++, in order to ask a question, a program makes an assertion which is evaluated to either true (nonzero) or false (zero) by the computer at run time. Example: In

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

Answers to Review Questions Chapter 7

Answers to Review Questions Chapter 7 1. The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element

Goals for This Lecture:

Goals for This Lecture: Understand the pass-by-value and passby-reference argument passing mechanisms of C++ Understand the use of C++ arrays Understand how arrays are passed to C++ functions Call-by-value

CpSc212 Goddard Notes Chapter 6. Yet More on Classes. We discuss the problems of comparing, copying, passing, outputting, and destructing

CpSc212 Goddard Notes Chapter 6 Yet More on Classes We discuss the problems of comparing, copying, passing, outputting, and destructing objects. 6.1 Object Storage, Allocation and Destructors Some objects

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection

Example of a Java program

Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);

Comp151. Definitions & Declarations

Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

Object Oriented Software Design

Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language

Simple C++ Programs Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input and Output Basic Functions from

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

Passing 1D arrays to functions.

Passing 1D arrays to functions. In C++ arrays can only be reference parameters. It is not possible to pass an array by value. Therefore, the ampersand (&) is omitted. What is actually passed to the function,

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

PIC 10A. Lecture 7: Graphics II and intro to the if statement

PIC 10A Lecture 7: Graphics II and intro to the if statement Setting up a coordinate system By default the viewing window has a coordinate system already set up for you 10-10 10-10 The origin is in the

While Loop. 6. Iteration

While Loop 1 Loop - a control structure that causes a set of statements to be executed repeatedly, (reiterated). While statement - most versatile type of loop in C++ false while boolean expression true

Common Beginner C++ Programming Mistakes

Common Beginner C++ Programming Mistakes This documents some common C++ mistakes that beginning programmers make. These errors are two types: Syntax errors these are detected at compile time and you won't

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

Chapter One Introduction to Programming

Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of

http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

Chapter 8 Selection 8-1

Chapter 8 Selection 8-1 Selection (Decision) The second control logic structure is selection: Selection Choosing between two or more alternative actions. Selection statements alter the sequential flow

Basics of I/O Streams and File I/O

Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading

In this Chapter you ll learn:

Now go, write it before them in a table, and note it in a book. Isaiah 30:8 To go beyond is as wrong as to fall short. Confucius Begin at the beginning, and go on till you come to the end: then stop. Lewis

Calling the Function. Two Function Declarations Here is a function declared as pass by value. Why use Pass By Reference?

Functions in C++ Let s take a look at an example declaration: Lecture 2 long factorial(int n) Functions The declaration above has the following meaning: The return type is long That means the function

Arrays. number: Motivation. Prof. Stewart Weiss. Software Design Lecture Notes Arrays

Motivation Suppose that we want a program that can read in a list of numbers and sort that list, or nd the largest value in that list. To be concrete about it, suppose we have 15 numbers to read in from

1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

Appendix K Introduction to Microsoft Visual C++ 6.0

Appendix K Introduction to Microsoft Visual C++ 6.0 This appendix serves as a quick reference for performing the following operations using the Microsoft Visual C++ integrated development environment (IDE):

C++ Language Tutorial

cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

MS Visual C++ Introduction. Quick Introduction. A1 Visual C++

MS Visual C++ Introduction 1 Quick Introduction The following pages provide a quick tutorial on using Microsoft Visual C++ 6.0 to produce a small project. There should be no major differences if you are

Ch 7-1. Object-Oriented Programming and Classes

2014-1 Ch 7-1. Object-Oriented Programming and Classes May 10, 2014 Advanced Networking Technology Lab. (YU-ANTL) Dept. of Information & Comm. Eng, Graduate School, Yeungnam University, KOREA (Tel : +82-53-810-2497;

OpenOffice.org 3.2 BASIC Guide

OpenOffice.org 3.2 BASIC Guide Copyright The contents of this document are subject to the Public Documentation License. You may only use this document if you comply with the terms of the license. See:

Chapter 5. Selection 5-1

Chapter 5 Selection 5-1 Selection (Decision) The second control logic structure is selection: Selection Choosing between two or more alternative actions. Selection statements alter the sequential flow

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:

In creating objects of the type, we have used statements similar to the following: f = new (); The parentheses in the expression () makes it look like a method, yet we never created such a method in our

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1

QUIZ-II Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For

Data Structures using OOP C++ Lecture 1

References: 1. E Balagurusamy, Object Oriented Programming with C++, 4 th edition, McGraw-Hill 2008. 2. Robert Lafore, Object-Oriented Programming in C++, 4 th edition, 2002, SAMS publishing. 3. Robert

The While Loop. Objectives. Textbook. WHILE Loops

Objectives The While Loop 1E3 Topic 6 To recognise when a WHILE loop is needed. To be able to predict what a given WHILE loop will do. To be able to write a correct WHILE loop. To be able to use a WHILE

The if Statement and Practice Problems

The if Statement and Practice Problems The Simple if Statement Use To specify the conditions under which a statement or group of statements should be executed. Form if (boolean-expression) statement; where

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

TIP: To access the WinRunner help system at any time, press the F1 key.

CHAPTER 11 TEST SCRIPT LANGUAGE We will now look at the TSL language. You have already been exposed to this language at various points of this book. All the recorded scripts that WinRunner creates when

Introduction to Matlab

Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. SSRL@American.edu Course Objective This course provides

SAPScript. A Standard Text is a like our normal documents. In Standard Text, you can create standard documents like letters, articles etc

SAPScript There are three components in SAPScript 1. Standard Text 2. Layout Set 3. ABAP/4 program SAPScript is the Word processing tool of SAP It has high level of integration with all SAP modules STANDARD

1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

One Dimension Array: Declaring a fixed-array, if array-name is the name of an array

Arrays in Visual Basic 6 An array is a collection of simple variables of the same type to which the computer can efficiently assign a list of values. Array variables have the same kinds of names as simple

Engineering Problem Solving with C++, Etter/Ingber

Engineering Problem Solving with C++, Etter/Ingber Chapter 3 Control Structures 1 Control structures Algorithm Development Conditional Expressions Selection Statements Repetition Statements Structuring

Sources: On the Web: Slides will be available on:

C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

7.7 Case Study: Calculating Depreciation

7.7 Case Study: Calculating Depreciation 1 7.7 Case Study: Calculating Depreciation PROBLEM Depreciation is a decrease in the value over time of some asset due to wear and tear, decay, declining price,

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

First CGI Script and Perl Perl in a nutshell Prof. Rasley shebang line tells the operating system where the Perl interpreter is located necessary on UNIX comment line ignored by the Perl interpreter End

UEE1302 (1102) F10 Introduction to Computers and Programming

Computational Intelligence on Automation Lab @ NCTU UEE1302 (1102) F10 Introduction to Computers and Programming Programming Lecture 03 Flow of Control (Part II): Repetition while,for & do..while Learning

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

Compiler Construction

Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from

COMPUTER SCIENCE 1999 (Delhi Board)

COMPUTER SCIENCE 1999 (Delhi Board) Time allowed: 3 hours Max. Marks: 70 Instructions: (i) All the questions are compulsory. (ii) Programming Language: C++ QUESTION l. (a) Why main function is special?

Chapter 9 Text Files User Defined Data Types User Defined Header Files

Chapter 9 Text Files User Defined Data Types User Defined Header Files 9-1 Using Text Files in Your C++ Programs 1. A text file is a file containing data you wish to use in your program. A text file does

5 Arrays and Pointers

5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004 Name: Instruction There are two parts in this test. The first part contains 50 questions worth 80 points. The second part constitutes 20 points

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Introduction to Programming (in C++) Loops Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Example Assume the following specification: Input: read a number N > 0 Output:

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Example Introduction to Programming (in C++) Loops Assume the following specification: Input: read a number N > 0 Output: write the sequence 1 2 3 N (one number per line) Jordi Cortadella, Ricard Gavaldà,

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

AP Computer Science Java Subset

APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

The C++ Language. Loops. ! Recall that a loop is another of the four basic programming language structures

The C++ Language Loops Loops! Recall that a loop is another of the four basic programming language structures Repeat statements until some condition is false. Condition False True Statement1 2 1 Loops

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

1 10 JavaScript: Arrays 2 With sobs and tears he sorted out Those of the largest size... Lewis Carroll Attempt the end, and never stand to doubt; Nothing s so hard, but search will find it out. Robert

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

Operator Overloading Lecture 8 Operator Overloading C++ feature that allows implementer-defined classes to specify class-specific function for operators Benefits allows classes to provide natural semantics

Computer Organization

Basics Machine, software, and program design JPC and JWD 2002 McGraw-Hill, Inc. Computer Organization CPU - central processing unit Where decisions are made, computations are performed, and input/output

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 UX Software - 2009 TABLE OF CONTENTS INTRODUCTION... ii What is this book about?... iii How to use this book... iii Time to start...

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :

Visual Basic Cheat Sheet

thecodingguys 2013 Visual Basic Cheat Sheet 12/24/2013 A cheat sheet to the Visual Basic language, ideal for newcomers to the language for more visit http://www.thecodingguys.net KEEP IN TOUCH TABLE OF

Chapter 2 Introduction to Java programming

Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break

Variables, Constants, and Data Types

Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

Changing the Display Frequency During Scanning Within an ImageControls 3 Application

Changing the Display Frequency During Scanning Within an ImageControls 3 Date November 2008 Applies To Kofax ImageControls 2x, 3x Summary This application note contains example code for changing he display

Visual Basic Programming. An Introduction

Visual Basic Programming An Introduction Why Visual Basic? Programming for the Windows User Interface is extremely complicated. Other Graphical User Interfaces (GUI) are no better. Visual Basic provides

if and if-else: Part 1

if and if-else: Part 1 Objectives Write if statements (including blocks) Write if-else statements (including blocks) Write nested if-else statements We will now talk about writing statements that make

Recursion. Slides. Programming in C++ Computer Science Dept Va Tech Aug., 2001. 1995-2001 Barnette ND, McQuain WD

1 Slides 1. Table of Contents 2. Definitions 3. Simple 4. Recursive Execution Trace 5. Attributes 6. Recursive Array Summation 7. Recursive Array Summation Trace 8. Coding Recursively 9. Recursive Design

Formatting Numbers with C++ Output Streams

Formatting Numbers with C++ Output Streams David Kieras, EECS Dept., Univ. of Michigan Revised for EECS 381, Winter 2004. Using the output operator with C++ streams is generally easy as pie, with the only

Introduction to Visual C++.NET Programming. Using.NET Environment

ECE 114-2 Introduction to Visual C++.NET Programming Dr. Z. Aliyazicioglu Cal Poly Pomona Electrical & Computer Engineering Cal Poly Pomona Electrical & Computer Engineering 1 Using.NET Environment Start

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

1. a procedure that you perform frequently. 2. Create a command. 3. Create a new. 4. Create custom for Excel.

Topics 1 Visual Basic Application Macro Language What You Can Do with VBA macro Types of VBA macro Recording VBA macros Example: MyName () If-Then statement Example: CheckCell () For-Next Loops Example:

Introduction to Java

Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

Using Casio Graphics Calculators

Using Casio Graphics Calculators (Some of this document is based on papers prepared by Donald Stover in January 2004.) This document summarizes calculation and programming operations with many contemporary

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is preceded by an equal sign d. its name has undereline 2. Associations

Visual Logic Instructions and Assignments

Visual Logic Instructions and Assignments Visual Logic can be installed from the CD that accompanies our textbook. It is a nifty tool for creating program flowcharts, but that is only half of the story.

Creating Applications using Excel Macros/Visual Basic for Applications (VBA)

Creating Applications using Excel Macros/Visual Basic for Applications (VBA) A macro is a sequence of instructions that tells Microsoft Excel what to do. These macros allow you to automate everyday tasks

«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.

JS Basic JS HOME JS Introduction JS How To JS Where To JS Statements JS Comments JS Variables JS Operators JS Comparisons JS If...Else JS Switch JS Popup Boxes JS Functions JS For Loop JS While Loop JS

C PROGRAMMING FOR MATHEMATICAL COMPUTING

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION BSc MATHEMATICS (2011 Admission Onwards) VI Semester Elective Course C PROGRAMMING FOR MATHEMATICAL COMPUTING QUESTION BANK Multiple Choice Questions

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

JavaScript: Control Statements I

1 7 JavaScript: Control Statements I 7.1 Introduction 2 The techniques you will learn here are applicable to most high-level languages, including JavaScript 1 7.2 Algorithms 3 Any computable problem can