Visual Basic. Chapter 3
|
|
- Carmel Newton
- 6 years ago
- Views:
Transcription
1 Visual Basic Chapter 3
2 Structured Visual Basic In this chapter, we will begin to learn how to write structured Visual Basic programs Creating a flowchart and/or creating pseudocode before you create the program ensures that you fully understand the design Makes the coding process faster and less errorprone!
3 Number-Doubling Program Recall the number-doubling program The program accepts a number as input and checks for the end of data condition. If the condition is not met, then the number is doubled, the answer is displayed and the next number is input.
4 Structured Solution Note that this program makes use of the sequence and loop structures. The correct solution primes the input and also gets the next input as the last step in the loop.
5 Starting the Program In the flowchart, the logic begins with the word start We have learned that to start a VB program, you first create a module Note that in Visual Studio, when you create a new project, the module is automatically created and named Module1 It is fine to keep the default name of Module1 If you wish to edit the module name, you will also need to make a change to the program properties. Described in Angel under Lessons->Start Here->How To s.. How to Change the Module Name on a Project in Visual Studio
6 Changing the Module Name
7 The Main Procedure The text describes adding a Main() sub procedure that is nested inside of the Module. Again, if using Visual Studio, this Sub procedure is automatically created. Sub Main is the entry point of the program and is what will execute when you run your program.
8 Compiler Options Option Explicit On This setting means that the Visual Basic compiler will enforce explicit variable declaration which means that you declare every variable before you use it On by default Option Strict On Enforces strict data typing Example, you cannot assign a variable of type Integer a value that is a Double Implicit data type conversions are restricted to only widening conversions Double can hold an Integer, but Integer cannot store a Double Off by default
9 The Program Structure The logic code we will add will go here
10 Variable Declarations In our flowchart logic, the next thing we do is to create two variables, originalnumber and calculatedanswer. We declared both as type num We are going to use whole numbers for our example, so when we create these variables in Visual Basic code, we will use the type Of Integer The green underlining is just a warning. It indicates that we have not yet used this variable.
11 Prompting the User The next step is prime the loop To prime the loop means to input the first value before the loop begins. In chapter 2 of the book, we learned how to create interactive input statements to allow the user to input data using InputBox$
12 Prompting the User We will be prompting the user by explaining what the program expects to receive as input. Recall that InputBox$ displays our message, but also inputs the user s response as a String Therefore, we will add another variable of type String to store the input
13 Converting to an Integer Recall that when inputting data in Visual Basic, the InputBox$ function returns a String We need to convert it to a number before we can work with it. Since we are working with whole numbers, we will use the Convert.ToInt32 method to convert the string and then assign to the Integer variable. The code is shown below. Moving forward, the screenshots only show the code inside Sub Main.
14 Checkp0int: Let s see where we are! Completed We will next need to implement the loop in Visual Basic code
15 Adding the Loop Structure In pseudocode, we created a loop with the keyword while and used keyword endwhile to indicate the end of the body of the loop. In Visual Basic we will use While and End While keywords In pseudocode, we used eof as the condition to exit the loop. Since we would like this program to be an interactive input program that ends when the user types 0 as their number, we will need to use a loop condition that checks if the user input is 0. In flowchart form, we represented the loop with a decision symbol followed by one or more actions and a flow line that bent back around to the start of the loop.
16 Adding the Loop Structure in VB End of the loop Start of the loop
17 The Loop Body Recall that the logic flow was represented by the following shapes: 1. Calculate the answer and assign to variable calculatedanswer. 2. Output calculatedanswer. 3. Input the next number and assign to variable originalnumber.
18 The Loop Body in Visual Basic The steps inside the loop are demonstrated in the next slide. The first statement does the calculation. The second statement displays the calculated result to the user. Recall that we can simplify System.Console.WriteLine to simply use Console.WriteLine when using Visual Studio. The third statement prompts the user and reads in the user s response. The last statement is necessary to convert from String input to an Integer type.
19 The Loop in Visual Basic Calcula te Display Promp Convert t& Assign
20 Checkpoint: Let s see where we are! We have completed most of the logic, we just have not accounted for the stop logic.
21 Stopping the Program In Visual Basic, the End Sub statement signifies the end of the Main() procedure and the End Module statement ends the NumberDouble module. At this point, the program is ready to be compiled and run.
22 The Complete Program
23 Running the Program Recall that in Visual Studio, you choose Build Solution to compile the program and Start Without Debugging to run it. If you directly choose Start Without Debugging, Visual Studio will automatically compile your changes for you.
24 Underscores You may encounter the underscore character (_) in some of the textbook examples and resources. The underscore is used to continue a single statement from one line to the next. It is often used for convenience if your code is scrolling too far to the right for you to conveniently see.
25 Number Doubling Program Input/Output
26 Local vs. Global Variables and Constants In Chapter 2 of the Programming Logic book, we learned about local and global variables and named constants. Local variables and local constants Declared in the procedure that uses them Available only within the procedure that declares them Global variables and global constants Declared at the program level Available to the entire program
27 Global Variables and Constants Note that it is not considered a best programming practice to use global variables, so the Visual Basic program we will look at next uses local variables as well as local constants only. Local variables and constants make a program easier to understand Global variables can be accessed and altered by any part of the program, which can make the program difficult to maintain and prone to error.
28 The Modular Program Recall from Chapter 2 that most programs consist of a main module or procedure that contains the mainline logic. The mainline logic of many procedural programs follows the structure of 1. Declarations of variables 2. Housekeeping tasks, such as displaying instructions to users, displaying report headers, opening files to read, priming the data 3. Detail loop tasks that do the main work, such as processing records and preforming calculations 4. End-of-job tasks, such as displaying totals and closing any open files
29 Payroll Report In this next section, we walk through the process of creating a Visual Basic program that implements the logic of the flowchart on the next slide. This program is a Payroll Report program that keeps looping until the user types in XXX for the name of the employee.
30 This logic will build a report that outputs Employees Names and their Gross, Deductions and Net pay. Input to the program is employee name and their gross pay. The program loops until the user types in XXX for the employee name.
31 Declaring the Variables We are familiar with how to start a program with a Module and Sub, let s move on to the variables. According to the flowchart and pseudocode, the mainline logic begins by declaring four global variables (name, gross, deduct, and net) and five global constants (RATE, QUIT, REPORT_HEADING, COLUMN_HEADING, and END_LINE).
32 Declaring the Variables The COLUMN_HEADIN G constant was not included because we have not yet learned about how to line up values in report format.
33 Declaring the Variables Recall that Dim is used to create variables and Const is used to create constants. Multiple variables of the same data type can be declared on one line as they are here or separate lines. If on the same line such as Gross, Deduct and Net, they must be commaseparated. We use Double instead of Integer because we are dealing with money and monetary values include a decimal point.
34 A Word about Words Note that in Chapter 2 of the Programming Logic book we referred to small units of code as modules. Modules could be called from the main logic. In Visual Basic, modules equates to procedures. While Visual Basic does have another level of logical groupings called Modules, the term procedure matches to the concept of what was described to be a module in the Programming Logic book. You may ask why are there two terms? Programming languages don t always use the same terminology to describe these reusable code blocks that can be called. Therefore the term module is used in the Programming Logic book to describe this general concept. When using Visual Basic, these will be referred to as procedures.
35 Housekeeping Recall that in the flowchart, the housekeeping() module is called next to print the REPORT_HEADING and COLUMN_HEADING constants and retrieves the first employee s name (primes the loop). For now the housekeeping logic is all part of Sub Main, but we ll comment the code so that we can see this logical chunk of the program. In later chapters, we will see how we can create more than one procedure in Visual Basic. This occurs in Chapter 9
36 Housekeeping in Visual Basic Local variables prompt and input
37 The Loop In the flowchart, the next statement to execute after housekeeping() finishes is the while loop that continues to execute until the user types in XXX when prompted for an employee s name. Within the while loop, detailloop() is called.
38 detailloop The work in detailloop() is to get an employee s gross pay; calculate deductions; calculate net pay; output employee s name, gross pay, deductions and net pay; and retrieving the next employee.
39 The Loop in Visual Basic For the interest of space, only the code inside of Sub Main is shown below. Get Gross Do calculations Output results Get next name
40 endofjob In the flowchart, when a user enters XXX for the employee s name, the program exits the while loop and calls the endofjob module The endofjob module is responsible for printing the value of the END_LINE constant. When endofjob finishes, control returns back to the mainline logic. As explained earlier, our endofjob logic will be implemented in Sub Main, but we will add a comment to illustrate where this chunk of logic begins.
41 Completed Code
Pseudo Code and Flow Charts. Chapter 1 Lesson 2
Pseudo Code and Flow Charts Chapter 1 Lesson 2 Pseudocode Using Pseudocode Statements and Flowchart Symbols English-like representation of the logical steps it takes to solve a problem Flowchart Pictorial
More informationC++ Programming Language Lecture 2 Problem Analysis and Solution Representation
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department Program Development Cycle Program development
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named
More informationA Beginner s Guide to Programming Logic, Introductory
A Beginner s Guide to Programming Logic, Introductory Chapter 3 Understanding Structure Objectives In this chapter, you will learn about: The features of unstructured spaghetti code The three basic structures
More informationSKILL 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,
More informationChapter 4: Writing and Designing a Complete Program. Programming Logic and Design, Third Edition Introductory
Chapter 4: Writing and Designing a Complete Program Programming Logic and Design, Third Edition Introductory Objectives After studying Chapter 4, you should be able to: Plan the mainline logic for a complete
More informationMicrosoft 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
More informationLesson 1. Introduction to Programming OBJECTIVES
Introduction to Programming If you re new to programming, you might be intimidated by code and flowcharts. You might even wonder how you ll ever understand them. This lesson offers some basic ideas and
More informationOutline. Program development cycle. Algorithms development and representation. Examples.
Outline Program development cycle. Algorithms development and representation. Examples. 1 Program Development Cycle Program development cycle steps: Problem definition. Problem analysis (understanding).
More information1. Getting Started Learning Outcomes Introduction Starting up Visual Basic for Applications Exercise 1...
1. Getting Started... 6 Learning Outcomes... 6 Introduction... 6 Starting up Visual Basic for Applications... 7 Exercise 1... 8 2. Writing your first programme... 9 Learning Outcomes... 9 Introduction...
More informationA Beginner s Guide to Programming Logic, Introductory. Chapter 2 Working with Data, Creating Modules, and Designing High-Quality Programs
A Beginner s Guide to Programming Logic, Introductory Chapter 2 Working with Data, Creating Modules, and Designing High-Quality Programs Objectives In this chapter, you will learn about: Declaring and
More informationPart 4 - Procedures and Functions
Part 4 - Procedures and Functions Problem Solving Methodology... 2 Top Down Design... 2 Procedures and Functions... 5 Sub Procedures... 6 Sending Parameters to a Sub Procedure... 7 Pass by Value... 8 Pass
More informationProgramming Logic and Design Seventh Edition Chapter 2 Elements of High-Quality Programs
Programming Logic and Design Chapter 2 Elements of High-Quality Programs Objectives In this chapter, you will learn about: Declaring and using variables and constants Assigning values to variables [assignment
More informationSpring 2017 CMSC 140 Programming Project 7: Payroll
Spring 2017 CMSC 140 Programming Project 7: Payroll Concepts tested by the program: 1. Working with arrays 2. Using file operations 3. Using a selection sort to sort parallel arrays 4. Using a binary search
More informationObject 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
More informationVariable A variable is a value that can change during the execution of a program.
Declare and use variables and constants Variable A variable is a value that can change during the execution of a program. Constant A constant is a value that is set when the program initializes and does
More informationAnnotation Annotation or block comments Provide high-level description and documentation of section of code More detail than simple comments
Variables, Data Types, and More Introduction In this lesson will introduce and study C annotation and comments C variables Identifiers C data types First thoughts on good coding style Declarations vs.
More informationIntroduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.
Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations
More informationYou 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
More informationChapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1
Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to
More informationIntroduction to Data Entry and Data Types
212 Chapter 4 Variables and Arithmetic Operations STEP 1 With the Toolbox visible (see Figure 4-21), click the Toolbox Close button. The Toolbox closes and the work area expands in size.to reshow the Toolbox
More informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation
More informationProgramming Logic and Design Seventh Edition
Programming Logic and Design Seventh Edition Chapter 3 Understanding Structure Objectives In this chapter, you will learn about: The disadvantages of unstructured spaghetti code The three basic structures
More informationProgramming Logic and Design Sixth Edition
Objectives Programming Logic and Design Sixth Edition Chapter 6 Arrays In this chapter, you will learn about: Arrays and how they occupy computer memory Manipulating an array to replace nested decisions
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #13. Loops: Do - While
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #13 Loops: Do - While So far we have been using while loops in C, now C programming language also provides you
More informationReview. Modules. CS 151 Review #6. Sample Program 6.1a:
Review Modules A key element of structured (well organized and documented) programs is their modularity: the breaking of code into small units. These units, or modules, that do not return a value are called
More informationProgramming Tips for Plugins
Programming Tips for Plugins Chad Neufeld Centre for Computational Geostatistics Department of Civil & Environmental Engineering University of Alberta Working in a university based research environment
More informationProgramming Logic and Design Sixth Edition Chapter 2 Working with Data, Creating Modules, and Designing High-Quality Programs
Objectives Programming Logic and Design Sixth Edition Chapter 2 Working with Data, Creating Modules, and Designing High-Quality Programs In this chapter, you will learn about: Declaring and using variables
More informationProgramming Language 2 (PL2)
Programming Language 2 (PL2) 337.1.1 - Explain rules for constructing various variable types of language 337.1.2 Identify the use of arithmetical and logical operators 337.1.3 Explain the rules of language
More informationFirst Visual Basic Lab Paycheck-V1.0
VISUAL BASIC LAB ASSIGNMENT #1 First Visual Basic Lab Paycheck-V1.0 Copyright 2013 Dan McElroy Paycheck-V1.0 The purpose of this lab assignment is to enter a Visual Basic project into Visual Studio and
More informationCHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042
CHAPTER 2 PROBLEM SOLVING TECHNIQUES Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 Software Engineering vs Problem Solving Software Engineering - A branch of Computer Science & provides
More informationFundamentals of Programming Session 4
Fundamentals of Programming Session 4 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2011 These slides are created using Deitel s slides, ( 1992-2010 by Pearson Education, Inc).
More informationPhysics 2660: Fundamentals of Scientific Computing. Lecture 3 Instructor: Prof. Chris Neu
Physics 2660: Fundamentals of Scientific Computing Lecture 3 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Announcements Weekly readings will be assigned and available through the class wiki home
More informationFunctions that Return a Value. Approximate completion time Pre-lab Reading Assignment 20 min. 92
L E S S O N S E T 6.2 Functions that Return a Value PURPOSE PROCEDURE 1. To introduce the concept of scope 2. To understand the difference between static, local and global variables 3. To introduce the
More informationPart 1 Your First Function
California State University, Sacramento College of Engineering and Computer Science and Snarky Professors Computer Science 10517: Super Mega Crazy Accelerated Intro to Programming Logic Spring 2016 Activity
More informationDeveloping Mixed Visual Basic/COBOL Applications*
COBOL 1 v1 11/9/2001 4:21 PM p1 Developing Mixed Visual Basic/COBOL Applications* Wayne Rippin If you are developing applications for Microsoft Windows, sooner or later you ll encounter one of the varieties
More informationCS111: PROGRAMMING LANGUAGE II
1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 4(b): Subclasses and Superclasses OOP OOP - Inheritance Inheritance represents the is a relationship between data types (e.g. student/person)
More informationLecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance?
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses
More informationCSCS 261 Programming Concepts Exam 1 Fall EXAM 1 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam.
Name: Print legibly! Section: COMPUTER SCIENCE 261 PROGRAMMING CONCEPTS EXAM 1 VERSION 1 Fall 2014 150 Points Absolutely no electronic devices may be used during this exam. 1. No cell phones, computers,
More informationChapter 1. C++ Basics. Copyright 2010 Pearson Addison-Wesley. All rights reserved
Chapter 1 C++ Basics Copyright 2010 Pearson Addison-Wesley. All rights reserved Learning Objectives Introduction to C++ Origins, Object-Oriented Programming, Terms Variables, Expressions, and Assignment
More informationChapter 1 Getting Started
Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different
More informationThis watermark does not appear in the registered version - Slide 1
Slide 1 Chapter 1 C++ Basics Slide 2 Learning Objectives Introduction to C++ Origins, Object-Oriented Programming, Terms Variables, Expressions, and Assignment Statements Console Input/Output Program Style
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 informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses
More informationADP Reporting Skills Business Requirements ADP Pro User Conference
ADP Reporting Skills Business Requirements 2015 ADP Pro User Conference Disclaimer The screen shots used in this presentation come from the current version of ADP Custom Reporting. What you see when you
More information9691 COMPUTING. 9691/21 Paper 2 (Written Paper), maximum raw mark 75
CAMBRIDGE INTERNATIONAL EXAMINATIONS GCE Advanced Subsidiary Level and GCE Advanced Level MARK SCHEME for the May/June 2013 series 9691 COMPUTING 9691/21 Paper 2 (Written Paper), maximum raw mark 75 This
More informationFinal Examination Semester 2 / Year 2010
Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2010 COURSE : PROGRAMMING LOGIC AND DESIGN COURSE CODE : CCIS1003 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM
More informationPROBLEM SOLVING WITH FORTRAN 90
David R. Brooks PROBLEM SOLVING WITH FORTRAN 90 FOR SCIENTISTS AND ENGINEERS Springer Contents Preface v 1.1 Overview for Instructors v 1.1.1 The Case for Fortran 90 vi 1.1.2 Structure of the Text vii
More informationEMPLOYEE ACCESS. Updated 04/12/12 1 of 13
If you are not a current Skyward user, you will have to email Cindy Crace (ccrace@gcs.k12.in.us) or Sandy Cook (sacook@gcs.k12.in.us) to obtain your Login and Password. If you are a current Skyward user,
More informationAn Overview of Visual Basic.NET: A History and a Demonstration
OVERVIEW o b j e c t i v e s This overview contains basic definitions and background information, including: A brief history of programming languages An introduction to the terminology used in object-oriented
More informationContents. More Controls 51. Visual Basic 1. Introduction to. xiii. Modify the Project 30. Print the Project Documentation 35
Contents Modify the Project 30 Introduction to Print the Project Documentation 35 Visual Basic 1 Sample Printout 36 Writing Windows Applications The Form Image 36 The Code 37 with Visual Basic 2 The Form
More informationA Fast Review of C Essentials Part I
A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types
More informationFinal Examination Semester 3 / Year 2010
Southern College Kolej Selatan 南方学院 Final Examination Semester 3 / Year 2010 COURSE : PROGRAMMING LOGIC AND DESIGN COURSE CODE : CCIS1003 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM
More informationStructured Programming Using C++ Lecture 2 : Introduction to the C++ Language. Dr. Amal Khalifa. Lecture Contents:
Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language Dr. Amal Khalifa Lecture Contents: Introduction to C++ Origins Object-Oriented Programming, Terms Libraries and Namespaces
More informationLECTURE 5 Control Structures Part 2
LECTURE 5 Control Structures Part 2 REPETITION STATEMENTS Repetition statements are called loops, and are used to repeat the same code multiple times in succession. The number of repetitions is based on
More informationLab 9: Creating a Reusable Class
Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming
More information(I m not printing out these notes! Take your own.)
PT1420 Week 2: Software Program Design I (I m not printing out these notes! Take your own.) Today we'll be discussing designing programs: Algorithms and errors Flowcharts and pseudocode Sequence structures
More informationIntroduction. C provides two styles of flow control:
Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if
More informationA Beginner s Guide to Programming Logic, Introductory. Chapter 6 Arrays
A Beginner s Guide to Programming Logic, Introductory Chapter 6 Arrays Objectives In this chapter, you will learn about: Arrays and how they occupy computer memory Manipulating an array to replace nested
More informationArrays. 1. Derived Data Types Outline
Derived Data Types Outline 1. Derived Data Types Outline 2. Arrays 3. A Company and Its Employees 4. Multiple Employees 5. A New Data Type 6. Breaking Down a Derived Type Definition 7. Declaring an Instance
More information1. C++ Overview. C++ Program Structure. Data Types. Assignment Statements. Input/Output Operations. Arithmetic Expressions.
1. C++ Overview 1. C++ Overview C++ Program Structure. Data Types. Assignment Statements. Input/Output Operations. Arithmetic Expressions. Interactive Mode, Batch Mode and Data Files. Common Programming
More informationRepetition 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
More information2. Numbers In, Numbers Out
COMP1917: Computing 1 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. COMP1917 15s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write down a proposed solution Break
More informationCondition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.
Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes
More informationChapter 2 Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion
More informationSU2017. LAB 1 (May 4/9) Introduction to C, Function Declaration vs. Definition, Basic I/O (scanf/printf, getchar/putchar)
SU2017. LAB 1 (May 4/9) Introduction to C, Function Declaration vs. Definition, Basic I/O (scanf/printf, getchar/putchar) 1 Problem A 1.1 Specification Write an ANSI-C program that reads input from the
More informationProgramming Logic and Design Ninth Edition
Programming Logic and Design Ninth Edition Chapter 3 Understanding Structure The Disadvantages of Unstructured Spaghetti Code Spaghetti code Logically snarled program statements Often a complicated mess
More informationLab # 02. Basic Elements of C++ _ Part1
Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special
More informationBasic memory model Using functions Writing functions. Basics Prototypes Parameters Return types Functions and memory Names and namespaces
Basic memory model Using functions Writing functions Basics Prototypes Parameters Return types Functions and memory Names and namespaces When a program runs it requires main memory (RAM) space for Program
More informationMARK SCHEME for the October/November 2013 series 9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75
CAMBRIDGE INTERNATIONAL EXAMINATIONS GCE Advanced Subsidiary Level and GCE Advanced Level MARK SCHEME for the October/November 2013 series 9691 COMPUTING 9691/23 Paper 2 (Written Paper), maximum raw mark
More informationLOOPS. Repetition using the while statement
1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while
More informationNumerical Computing in C and C++ Jamie Griffin. Semester A 2017 Lecture 2
Numerical Computing in C and C++ Jamie Griffin Semester A 2017 Lecture 2 Visual Studio in QM PC rooms Microsoft Visual Studio Community 2015. Bancroft Building 1.15a; Queen s W207, EB7; Engineering W128.D.
More informationCSCI 1061U Programming Workshop 2. C++ Basics
CSCI 1061U Programming Workshop 2 C++ Basics 1 Learning Objectives Introduction to C++ Origins, Object-Oriented Programming, Terms Variables, Expressions, and Assignment Statements Console Input/Output
More informationCSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 1 Edgardo Molina Fall 2013 City College of New York 1 Introduction to Computing Lectures: Tuesday and Thursday s (2-2:50 pm) Location: NAC 1/202 Recitation:
More informationAgenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals
Agenda & Reading COMPSCI 80 S Applications Programming Programming Fundamentals Data s Agenda: Data s Value s Reference s Constants Literals Enumerations Conversions Implicitly Explicitly Boxing and unboxing
More informationFundamentals of Programming Session 7
Fundamentals of Programming Session 7 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2014 These slides have been created using Deitel s slides Sharif University of Technology Outlines
More informationPre-Release Material Tasks
1 P a g e P r e - R e l e a s e M a t e r i a l ( M a y / Jun 17 ) Pre-Release Material Tasks The organizer of a senior citizens club arranges outings for the members. For each of these outings a coach
More informationFundamentals of Structured Programming
Fundamentals of Structured Programming Dr. Salma Hamdy s.hamdy@cis.asu.edu.eg 1 Course Logistics Staff Teachers Prof. Mohamed Roushdy (Dean) Dr. Salma Hamdy Contact: s.hamdy@cis.asu.edu.eg Office: FCIS,
More information1 Information system An information system is the combination of technology(computers) and people that enable an organization to collect data, store them, and transform them into information Data Data
More informationPROBLEM SOLVING. Week 2 BITE 1513 Computer Game Programming
PROBLEM SOLVING Week 2 BITE 1513 Computer Game Programming Scopes To implement basic problem solving techniques. 1.To understand the software development method. 2.To be able to develop flow chart and
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence
More informationObject-Oriented Programming
Object-Oriented Programming 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 Object-Oriented
More informationProgramming Fundamentals for Engineers Functions. Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. Modular programming.
Programming Fundamentals for Engineers - 0702113 7. Functions Muntaser Abulafi Yacoub Sabatin Omar Qaraeen 1 Modular programming Your program main() function Calls AnotherFunction1() Returns the results
More informationOur Strategy for Learning Fortran 90
Our Strategy for Learning Fortran 90 We want to consider some computational problems which build in complexity. evaluating an integral solving nonlinear equations vector/matrix operations fitting data
More informationChapter 2: Using Data
Chapter 2: Using Data Declaring Variables Constant Cannot be changed after a program is compiled Variable A named location in computer memory that can hold different values at different points in time
More informationProject 3: RPN Calculator
ECE267 @ UIC, Spring 2012, Wenjing Rao Project 3: RPN Calculator What to do: Ask the user to input a string of expression in RPN form (+ - * / ), use a stack to evaluate the result and display the result
More informationCpt S 122 Data Structures. Introduction to C++ Part II
Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function
More informationObjectives. 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)
More informationSTUDENT LESSON A12 Iterations
STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of
More informationCS 1044 Program 1 Fall 1998
Learning to Use the Development Environment Obviously you cannot program unless you understand how to create a file containing your C++ language source code, how to compile and link the source code to
More informationLoop Structures. Loop Structures. Algorithm to record 5 TV programmes. Recall Structured Programming..3 basic control structures.
Loop Structures Recall Structured Programming..3 basic control structures Sequence Input -> Process -> Output Selection IF ENDIF SELECT CASE END SELECT Loop Structures DO WHILE LOOP DO LOOP UNTIL FOR NEXT
More informationIslamic University of Gaza Computer Engineering Dept. C++ Programming. For Industrial And Electrical Engineering By Instructor: Ruba A.
Islamic University of Gaza Computer Engineering Dept. C++ Programming For Industrial And Electrical Engineering By Instructor: Ruba A. Salamh Chapter Four: Loops 2 Chapter Goals To implement while, for
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4(b): Inheritance & Polymorphism Lecture Contents What is Inheritance? Super-class & sub class The object class Using extends keyword
More informationDATA AND ABSTRACTION. Today you will learn : How to work with variables How to break a program down Good program design
DATA AND ABSTRACTION Today you will learn : How to work with variables How to break a program down Good program design VARIABLES Variables are a named memory location Before you use a variable you must
More informationProgramming Logic Beginning
Programming Logic Beginning 152-101 Designing Programs and Applications Quick Links & Text References Program Design Pages 23 27 Algorithms Pages 25 26 Levels of Design Pages IOPs Pages User Interface
More informationCOMPUTER PROGRAMMING FOR BUSINESS (BMGT 121)
COMPUTER PROGRAMMING FOR BUSINESS (BMGT 121) 1. Course outline... 3 2. Week1-6: Introduction to computer programming and office automation... 4 2.1. Definition of Programming...... 4 2.2. IT concepts......
More information20. VB Programming Fundamentals Variables and Procedures
20. VB Programming Fundamentals Variables and Procedures 20.1 Variables and Constants VB, like other programming languages, uses variables for storing values. Variables have a name and a data type. Array
More informationStarting Out With Visual Basic 2012, 6th Edition Page 1
Starting Out With Visual Basic 2012, 6th Edition Page 1 Instant download and all chapters Solutions Manual Starting Out With Visual Basic 2012 6th Edition Gaddis, Irvine https://testbankdata.com/download/solutions-manual-starting-visual-basic-
More informationQuiz Determine the output of the following program:
Quiz Determine the output of the following program: 1 Structured Programming Using C++ Lecture 4 : Loops & Iterations Dr. Amal Khalifa Dr. Amal Khalifa - Spring 2012 1 Lecture Contents: Loops While do-while
More informationIntroduction to Computer Use II
Winter 2005 (Section M) Topic B: Variables, Data Types and Expressions Wednesday, January 18 2006 COSC 1530, Winter 2006, Overview (1): Before We Begin Some administrative details Some questions to consider
More information