SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS
|
|
- Bruno Gardner
- 6 years ago
- Views:
Transcription
1 Add your company slogan SKILL AREA 306: DEVELOP AND IMPLEMENT COMPUTER PROGRAMS Computer Programming (YPG) LOGO
2 306.1 Review Selected Programming Environment Explain the concept of reserve words, variables, constants and strings Use arithmetical and relational operators Construct Identifiers
3 Variables Variables: computer memory locations used to store data while an application is running Use a meaningful variable name that reflects the purpose of the variable Use camel casing for variable identifiers Variable names should conform to naming rules
4 Variables (continued) Figure : How to name a variable
5 Variables (continued) Each variable must be assigned a data type Data type: the type of data the variable can store Each data type is a class Unicode: Universal coding scheme for characters Assigns a unique numeric value to each character
6 Figure : Basic data types in Visual Basic
7 Declaring a Variable in Code Declaration statement: used to declare, or create, a variable Declaration statement includes Scope keyword: Dim, Private, or Static Name of the variable Data type Initial value (optional) Numeric data types are automatically initialized to 0 String data type is automatically initialized to
8 Figure : How to declare a variable
9 Assigning Data to an Existing Variable Assignment statement: Used to assign values to properties of controls Used to assign values to variables Assignment operator: (=) Value on the right of the = operator is assigned to the variable on the left of the = operator
10 Assigning Data to an Existing Variable (continued) String: group of characters enclosed in quotation marks Literal constant: An item of data whose value does not change while the application is running Can be a numeric or a string literal constant A numeric literal without a decimal place is treated as an integer A numeric literal with a decimal place is treated as a Double type
11 Figure : How to assign a value to a variable
12 Using the TryParse Method Method: a specific portion of a class s instructions that performs a task for the class TryParse method: Part of every numeric data type s class Used to convert a string to that numeric data type Argument: a value that is provided to a method Basic syntax of TryParse method has two arguments: String: string value to be converted Variable: location to store the result
13 Using the TryParse Method (continued) If TryParse conversion is successful, the method stores the value in the variable If unsuccessful, a 0 is stored in the numeric variable
14 Figure : How to use the basic syntax of the TryParse method
15 Using the Convert Class 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
16 Figure : How to use the Convert class methods
17 Option Explicit, Option Infer, and Option Strict Undeclared variable: a variable that does not appear in a declaration statement (such as Dim) Is assigned a data type of Object Misspelling a variable name can result in an undeclared variable unless Option Explicit is on Option Explicit On statement Appears in the General Declarations section of the Code Editor window (above Public Class statement) Enforces that all variables must be declared before being used
18 Option Explicit, Option Infer, and Option Strict (continued) Option Infer Off statement: ensures that every variable is declared with a data type Implicit type conversion: occurs when you attempt to assign data of one type to a variable of another type without explicitly attempting to convert it If converted to a data type that can store larger numbers, the value is said to be promoted If converted to a data type that can store only smaller numbers, the value is said to be demoted Can cause truncation and loss of precision
19 Option Explicit, Option Infer, and Option Strict (continued) Option Strict On statement: ensures that values cannot be converted from one data type to a narrower data type, resulting in lost precision Figure : Option statements entered in the General Declarations section
20 Figure : Rules and examples of type conversions
21 Using a Variable in an Arithmetic Expression Arithmetic operators: used to perform calculations Precedence number: indicates the order in which an operation in an expression is performed If an expression has two operators with the same precedence, they are evaluated from left to right Use parentheses to change the order of evaluation Integer division operator (\): divides two integers and returns an integer value Modulus arithmetic operator (Mod): divides two numbers and returns the remainder
22 Using a Variable in an Arithmetic Expression (continued) Figure : Most commonly used arithmetic operators and order of precedence
23 Figure : How to include arithmetic expressions in assignment statements
24 Using a Variable in an Arithmetic Expression (continued) Line continuation character (_): Used to break up a long instruction into two or more physical lines Underscore must be preceded by a space and must appear at the end of a physical line A variable can store only one value at a time A second assignment statement on the same variable will replace its current value with the new value
25 The Scope and Lifetime of a Variable Scope: indicates where the variable can be used Lifetime: indicates how long the variable remains in memory Variables can have module scope, procedure scope, or block scope Module scope: variable is declared in the form s Declarations section Variables declared within a procedure have either procedure scope or block scope
26 Using Variables Having Procedure Scope Procedure-level variable: declared within a procedure Use the Dim keyword in the declaration Procedure scope: only the procedure can use the variable With procedure-level scope, two procedures can each use the same variable names Comments: Used to internally document the procedure Are ignored by the compiler Appear in green in the Code Editor
27 Figure : The MainForm in the Sales Tax application Figure : Examples of using procedure-level variables
28 Using a Variable Having Module Scope (continued) Module scope: variable can be used by all procedures in the form Module-level variable: Declared in the form s Declarations section Use Private keyword in declaration Module-level variables retain their values until the application ends
29 Figure : Example of using a module-level variable
30 Static Variables Static variable: Procedure-level variable that retains its value even after the procedure ends Retains its value until the application ends (like a module-level variable), but can only be used by the procedure in which it is declared A static variable has: Same lifetime as a module-level variable Narrower scope than a module-level variable Declared using the Static keyword
31 Figure : The MainForm in the Total Sales application Figure : Example of using a static variable
32 Named Constants Named constant: memory location whose value cannot be changed while the application is running Declared using the Const keyword Good programming practice to specify the data type as well Many programmers use Pascal case for named constants Literal type character: forces a literal constant to assume a specific data type Named constants help to document the program code
33 Figure : How to declare a named constant
34 Figure : The MainForm in the Area Calculator application Figure : Example of using a named constant
35 Coding the Sunshine Cellular Application Figure : Sunshine Cellular interface
36 Coding the Sunshine Cellular Application (continued) Figure : Sunshine Cellular TOE chart
37 Using Pseudocode to Plan a Procedure Pseudocode: short phrases that describe the steps a procedure needs to take to accomplish its goal Figure : Pseudocode for the Sunshine Cellular application
38 Using a Flowchart to Plan a Procedure Flowchart: uses standardized symbols to show the steps a procedure must take to accomplish its goal Can be used in place of pseudocode for planning Three symbols: Start/stop symbol (oval): indicates start and stop points Process symbol (rectangle): represents tasks Input/output symbol (parallelogram): represents input or output tasks Flowlines: connect the symbols to show the direction
39 Figure : Flowcharts for the Sunshine Cellular application
40 Coding the Calculate Order Button s Click Event Procedure Figure : Pseudocode for the calcbutton s Click event procedure
41 Coding the Calculate Order Button s Click Event Procedure (continued) Figure : Named constants and variables for the calcbutton s Click event procedure
42 Coding the Calculate Order Button s Click Event Procedure (continued) Figure : Declaration statements entered in the calcbutton s Click event procedure
43 Coding the Calculate Order Button s Click Event Procedure (continued) Figure : User input assigned to variables
44 Coding the Calculate Order Button s Click Event Procedure (continued) Figure : Completed calcbutton s Click event procedure
45 Completing the Sunshine Cellular Application Focus method: moves the focus to a specified control when the application is running Figure : Pseudocode for the clearbutton s Click event procedure
46 Figure : The Sunshine Cellular application s code
47 Figure : The Sunshine Cellular application s code (continued)
48 Testing and Debugging the Application Bug: an error in the program code Valid data: data that the application is expecting Invalid data: data that is unexpected Debugging: process of locating and correcting errors in a program
49 Testing and Debugging the Application (continued) Syntax error: an error that violates the programming language s syntax Usually caused by mistyping Logic error: occurs when you enter an instruction that does not give the expected results Test a program with both valid and invalid data
50 Testing and Debugging the Application (continued) Figure 3-30: Result of testing the application using valid data
51 Testing and Debugging the Application (continued) Figure : Result of testing the application using invalid data
52 Formatting Numeric Output Formatting: specifying the number of decimal places and any special characters to display ToString method of a variable can be used to format a number Format specifier: specifies the type of formatting to use Precision specifier: controls the number of significant digits or zeros to the right of the decimal point
53 Figure : How to format a number
54 Formatting Numeric Output (continued) Figure : calcbutton s modified Click event procedure
55 Formatting Numeric Output (continued) Figure : Formatted output shown in the interface
56 Programming Tutorial Figure : User interface
57 Summary Variables and named constants are memory locations that store data Variables can change value, but constants cannot Variables and constants have a name, data type, initial value, scope, and lifetime Use Dim or Static to declare a variable at block or procedure level Use Private to declare a variable at module level
58 Summary (continued) Assignment statement is used to assign values to an existing variable Literals are constant items of data that do not change String literal constants are enclosed in quotation marks Use the TryParse method to convert a string to a number The Convert class contains methods to convert values to a specified data type
59 Summary (continued) Option Explicit On forces declaration of all variables before use Option Infer Off warns if a variable declaration does not include a data type Option Strict On disallows any implicit type conversions that may cause a loss of data Integer division operator divides two integers and returns the result Modulus operator divides two numbers and returns the remainder
60 Summary (continued) A procedure-level variable is usable only by the procedure in which it is declared A module-level variable is usable by all procedures in the form Use comments to document your code A static variable is a procedure-level variable that retains its value even when the procedure ends Pseudocode or a flowchart is used to plan a procedure s code
61 Summary (continued) You can clear the contents of a text box or label control by assigning an empty string or String.Empty value The Focus method moves the focus to a control Test a program with both valid and invalid data You can format a program s numeric output with special characters, such as for currency, percentages, and number of decimal places
Microsoft 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 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 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 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 informationSkill Area 306: Develop and Implement Computer Program
Add your company slogan Skill Area 306: Develop and Implement Computer Program Computer Programming (YPG) LOGO Skill Area 306.2: Produce Structured Program 306.2.1 Write Algorithm 306.2.2 Apply appropriate
More informationModule 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1
Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions
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 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 informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationVisual BASIC Creating an Application. Choose File New Project from the menu
Creating an Application Choose File New Project from the menu Choose Windows Application Name the project Copyright Project Place a check in the Create directory for solution box Click Browse Choose and/or
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
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
More informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationCIS 3260 Intro to Programming with C#
Variables, Constants and Calculations McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Define a variable Distinguish between variables, constants, and control objects Differentiate
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 informationLanguage Fundamentals
Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
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 informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
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 information4. The is a diagram that graphically depicts the steps that take place in a program. a. Program b. Flowchart c. Algorithm d. Code e.
Gaddis: Starting Out with Programming Logic & Design Test Bank Chapter Two MULTIPLE CHOICE 1. Which error produces incorrect results but does not prevent the program from running? a. syntax b. logic c.
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationC: How to Program. Week /Mar/05
1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers
More informationFRAC: 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
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 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 informationReserved Words and Identifiers
1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the
More informationOn a 64-bit CPU. Size/Range vary by CPU model and Word size.
On a 64-bit CPU. Size/Range vary by CPU model and Word size. unsigned short x; //range 0 to 65553 signed short x; //range ± 32767 short x; //assumed signed There are (usually) no unsigned floats or doubles.
More informationObjectives. 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
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationCSc 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
More informationChapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic
More informationVB 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
More information1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.
Gaddis: Starting Out with Python, 2e - Test Bank Chapter Two MULTIPLE CHOICE 1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical
More informationBoredGames 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...
More informationDeclaration and Memory
Declaration and Memory With the declaration int width; the compiler will set aside a 4-byte (32-bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier
More informationOutline. Data and Operations. Data Types. Integral Types
Outline Data and Operations Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations Data and Operations
More informationc) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.
2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C
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 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 informationLesson 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
More informationJava 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,
More informationArithmetic Operations
232 Chapter 4 Variables and Arithmetic Operations Arithmetic Operations The ability to perform arithmetic operations on numeric data is fundamental to computer programs. Many programs require arithmetic
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationChapter 3 Syntax, Errors, and Debugging. Fundamentals of Java
Chapter 3 Syntax, Errors, and Debugging Objectives Construct and use numeric and string literals. Name and use variables and constants. Create arithmetic expressions. Understand the precedence of different
More informationAn Introduction to Programming with C++ Sixth Edition. Chapter 2 Beginning the Problem-Solving Process
An Introduction to Programming with C++ Sixth Edition Chapter 2 Beginning the Problem-Solving Process Objectives Explain the problem-solving process used to create a computer program Analyze a problem
More informationProgram Fundamentals
Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java
More informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
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 informationIntroduction 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
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationIntroduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan
Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,
More informationVARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals
VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,
More informationFull file at C How to Program, 6/e Multiple Choice Test Bank
2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
More informationChapter 3 Structure of a C Program
Chapter 3 Structure of a C Program Objectives To be able to list and describe the six expression categories To understand the rules of precedence and associativity in evaluating expressions To understand
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationChapter 7 Arithmetic
Chapter 7 Arithmetic 7-1 Arithmetic in C++ Arithmetic expressions are made up of constants, variables, operators and parentheses. The arithmetic operators in C++ are as follows + (addition) - (subtraction)
More informationIntroduction to Programming
Introduction to Programming session 6 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Spring 2011 These slides are created using Deitel s slides Sharif University of Technology Outlines
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:
Java Programming, Eighth Edition 2-1 Chapter 2 Using Data A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance your teaching experience through classroom
More informationGraphQuil Language Reference Manual COMS W4115
GraphQuil Language Reference Manual COMS W4115 Steven Weiner (Systems Architect), Jon Paul (Manager), John Heizelman (Language Guru), Gemma Ragozzine (Tester) Chapter 1 - Introduction Chapter 2 - Types
More informationLesson 02 Working with Data Types MIT 31043, Visual Programming By: S. Sabraz Nawaz
Lesson 02 Working with Data Types MIT 31043, Visual Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT Faculty of Management and Commerce South Eastern University of Sri Lanka Variables
More informationProgramming for Engineers Introduction to C
Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines
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 informationd2vbaref.doc Page 1 of 22 05/11/02 14:21
Database Design 2 1. VBA or Macros?... 2 1.1 Advantages of VBA:... 2 1.2 When to use macros... 3 1.3 From here...... 3 2. A simple event procedure... 4 2.1 The code explained... 4 2.2 How does the error
More informationLecture 3 Tao Wang 1
Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationMurach s Visual Basic 2012, C4 2013, Mike Murach & Associates, Inc. Slide 1. The built-in value types (continued)
The built-in value types Keyword Bytes Type Description Byte 1 Byte Positive integer value from 0 to 255 SByte 1 SByte Signed integer value from -128 to 127 Short 2 Int16 Integer from 32,768 to +32,767
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 informationVARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.
Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer
More informationComputers Programming Course 6. Iulian Năstac
Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap
More informationVBScript: Math Functions
C h a p t e r 3 VBScript: Math Functions In this chapter, you will learn how to use the following VBScript functions to World Class standards: 1. Writing Math Equations in VBScripts 2. Beginning a New
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine
More informationIntro to Computer Programming (ICP) Rab Nawaz Jadoon
Intro to Computer Programming (ICP) Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) What
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationVba Variables Constant and Data types in Excel
Vba Variables Constant and Data types in Excel VARIABLES In Excel VBA, variables are areas allocated by the computer memory to hold data. Data stored inside the computer memory has 4 properties: names,
More informationChapter 1: An Overview of Computers and Logic
Chapter 1: An Overview of Computers and Logic Programming Logic and Design, Third Edition Comprehensive Objectives After studying Chapter 1, you should be able to: Understand computer components and operations
More informationProgramming for Engineers Iteration
Programming for Engineers Iteration ICEN 200 Spring 2018 Prof. Dola Saha 1 Data type conversions Grade average example,-./0 class average = 23450-67 893/0298 Grade and number of students can be integers
More informationX Language Definition
X Language Definition David May: November 1, 2016 The X Language X is a simple sequential programming language. It is easy to compile and an X compiler written in X is available to simplify porting between
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationCIS 3260 Intro. to Programming with C#
Running Your First Program in Visual C# 2008 McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Run Visual Studio Start a New Project Select File/New/Project Visual C# and Windows must
More informationModel Viva Questions for Programming in C lab
Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous
More informationOperators. Java Primer Operators-1 Scott MacKenzie = 2. (b) (a)
Operators Representing and storing primitive data types is, of course, essential for any computer language. But, so, too, is the ability to perform operations on data. Java supports a comprehensive set
More informationBit (0, 1) Byte (8 bits: 0-255) Numeral systems. Binary (bin) 0,1 Decimal (dec) 0, 1, 2, 3, Hexadecimal (hex) 0, 1, 2, 3, 1/13/2011
* VB.NET Syntax I 1. Elements of code 2. Declaration and statements 3. Naming convention 4. Types and user defined types 5. Enumerations and variables Bit (0, 1) Byte (8 bits: 0-255) Numeral systems Binary
More informationANSI C Programming Simple Programs
ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.
More informationData and Operations. Outline
Data and Operations Data and Operations 1 Outline Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and
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 informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
More information(2-1) Numeric Expressions in C H&K Chapter 2. Instructor - Andrew S. O Fallon CptS 121 (August 27, 2018) Washington State University
(2-1) Numeric Expressions in C H&K Chapter 2 Instructor - Andrew S. O Fallon CptS 121 (August 27, 2018) Washington State University Arithmetic Expressions Most programming problems require arithmetic expressions
More informationNOTES: Variables & Constants (module 10)
Computer Science 110 NAME: NOTES: Variables & Constants (module 10) Introduction to Variables A variable is like a container. Like any other container, its purpose is to temporarily hold or store something.
More informationIndex. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309
A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48
More information