1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

Slides:



Advertisements
Similar presentations
Chapter 3 – Fundamental Statements
Advertisements

Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
Principles of Programming Fundamental of C Programming Language and Basic Input/Output Function 1.
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Basic Elements of C++ Chapter 2.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
CIS Computer Programming Logic
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Input, Output, and Processing
1 © 2000 John Urrutia. All rights reserved. Qbasic Looping Statements & Formatted Output.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 2: Basic Elements of C++
Chapter 2: Java Fundamentals
1 © 2002 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
Java Programming: From Problem Analysis to Program Design, 5e Chapter 2 Basic Elements of Java.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
Introduction to C++ Basic Elements of C++. C++ Programming: From Problem Analysis to Program Design, Fourth Edition2 The Basics of a C++ Program Function:
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Introduction to Computer Programming
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Structured Programming
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Three Memory Locations and Calculations.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Agenda Comments Identifiers Keywords Syntax and Symentics Indentation Variables Datatype Operator.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
C++ First Steps.
Chapter 1.2 Introduction to C++ Programming
TK1913 C++ Programming Basic Elements of C++.
Chapter 2: Basic Elements of C++
Chapter Topics The Basics of a C++ Program Data Types
Topics Designing a Program Input, Processing, and Output
Chapter 1.2 Introduction to C++ Programming
Input and Output Upsorn Praphamontripong CS 1110
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
BASIC ELEMENTS OF A COMPUTER PROGRAM
Structured Programming
Basic Elements of C++.
The Selection Structure
Introduction to C++.
Java Programming: From Problem Analysis to Program Design, 4e
Chapter 2: Basic Elements of C++
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
Basic Elements of C++ Chapter 2.
2.1 Parts of a C++ Program.
Introduction to C++ Programming
Chapter 2: Basic Elements of Java
CS111 Computer Programming
Topics Designing a Program Input, Processing, and Output
Fundamentals of visual basic
Topics Designing a Program Input, Processing, and Output
Chapter 2: Introduction to C++.
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Chapter 2 Primitive Data Types and Operations
Chapter 2 Modular Programs with Calculations and Strings
Presentation transcript:

1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs

2 © 2000 John Urrutia. All rights reserved. Program Development Problem definition – statement  Who – The person, group, organization  What – The record, file, system, data  When – The timeframe  Where – The location  Why – The business reason

3 © 2000 John Urrutia. All rights reserved. Program Development Problem definition - decomposition  Data  Input – what are the data sources.  Output – what are the data sinks.  Process  Detailed description of how the Input is manipulated into Output.

4 © 2000 John Urrutia. All rights reserved. Program Development Program design – Algorithm  Sequence – linear execution of instructions  Selection – Identify a processing path  Binary  Case  Iteration – repetitive execution of instructions

5 © 2000 John Urrutia. All rights reserved. Program Development Program design – Flowcharts  A graphical representation of the problem definition Process Decision Termination Manual Screen

6 © 2000 John Urrutia. All rights reserved. Program Development Program design – Pseudocode  An English-like representation of the problem definition  IF the meat is green Then move it to the waste bucket Else move it to the good bucket

7 © 2000 John Urrutia. All rights reserved. Program Development Implementation – coding The syntactical exercise of converting the program design into a specific programming language.

8 © 2000 John Urrutia. All rights reserved. Program Development V&V –Verification & Validation  Specification errors  Syntax errors  Logic errors

9 © 2000 John Urrutia. All rights reserved. Program Development Documentation  Program - internal  User - external

10 © 2000 John Urrutia. All rights reserved. B. A. S. I. C. Beginners All-purpose Symbolic Instruction Code QBasic – QuickBASIC

11 © 2000 John Urrutia. All rights reserved. Qbasic Character Set Letters: a-z and A-Z Digits: 0-9 Blank: the space character ( ) Special characters: + - * / \ =., ’ ” ( ) : ; ^ _ $ # ? ! % &

12 © 2000 John Urrutia. All rights reserved. Qbasic Keywords A keyword has a predefined meaning within Qbasic.  Examples: LET END REM PRINT

13 © 2000 John Urrutia. All rights reserved. Qbasic Data Types All data in Qbasic is identified by a data type  Numbers  % – Integer -32,768 to 32,767  & – Long integer -2,147,483,648 to 2,147,483,647  ! – Single precision 7 digit ( 10 38)  # – Double precision 15 digit ( )

14 © 2000 John Urrutia. All rights reserved. Qbasic Data Types  Strings:  Any set of characters enclosed in double quotation marks.  “ ”  Maximum of 14,656 Characters

15 © 2000 John Urrutia. All rights reserved. Constants & Variables Constants  “literal” values that cannot be changed  No label Variables  Value can be changed  Referenced by a label

16 © 2000 John Urrutia. All rights reserved. Labels A name assigned to represent a variable.  Must start with a letter Should be meaningful. Can have periods imbedded. Should carry the data type.

17 © 2000 John Urrutia. All rights reserved. The LET statement Assigns a value to a variable. Can be Explicit or Implicit LET variable.Name = value LET my.nbr! = 0 LET my.str$ = “This is my string” LET tot! = tot! + purchases! + taxes!

18 © 2000 John Urrutia. All rights reserved. The PRINT statement Writes information to the terminal. PRINT output-list PRINT X$ PRINT PRINT “Hello World” PRINT (prints a blank line)

19 © 2000 John Urrutia. All rights reserved. The END statement END terminates execution Closes any open files. Not required but highly recommended.

20 © 2000 John Urrutia. All rights reserved. The CLS statement CLear Screen  Erases all characters from the terminal  Places cursor at position 0,0 (top left corner)

21 © 2000 John Urrutia. All rights reserved. The REM statement The REM ark statement  Treats everything to the right as a comment.  ‘ – Is short hand for the REM

22 © 2000 John Urrutia. All rights reserved. SPACE$(), SPC() and TAB() SPACE$(n)  Returns a string of n spaces SPC(n) – skips n spaces TAB(n) – specifies an exact column

23 © 2000 John Urrutia. All rights reserved. The PRINT USING statement Writes formatted data to the teminal PRINT USING “ format-string ” ; output-list The format-string specifies  Numeric edited data formats  String formats  Literal data

24 © 2000 John Urrutia. All rights reserved. USING format characters Strings  \n\ – first n +2 characters in the string  ! – first character in the string  & – no formatting  _ – print character not format

25 © 2000 John Urrutia. All rights reserved. USING format characters Numbers  # – number digit . – decimal point , – thousands separator  + – sign of number  - – trailing minus sign  $ $$ – fixed / floating dollar sign