Introduction to Computing Dr. Nadeem A Khan. Lecture 9.

Slides:



Advertisements
Similar presentations
Introduction to Computing Dr. Nadeem A Khan. Lecture 21.
Advertisements

Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Introduction to Computing Dr. Nadeem A Khan. Lecture 23.
Fundamentals of Programming in Visual Basic
Introduction to Computing Dr. Nadeem A Khan. Lecture 22.
Introduction to Computing Dr. Nadeem A Khan. Lecture 8.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Introduction to Computing Dr. Nadeem A Khan. Lecture 27.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to VB prepared by Dr. I A Moneim Reference Book Schneider.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 9 Structures and Sequential Access Files.
Introduction to Computing Dr. Nadeem A Khan. Lecture
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Introduction to Computing Dr. Nadeem A Khan. Lecture 17.
Introduction to Computing Dr. Nadeem A Khan. Lecture 19.
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Introduction to Computing Dr. Nadeem A Khan. Lecture 14.
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
Introduction to Computing Dr. Nadeem A Khan. Lecture 6.
Introduction to Computing Dr. Nadeem A Khan. Lecture 28.
Introduction to Computing Dr. Nadeem A Khan. Lecture 13.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 6P. 1Winter Quarter I/O in C Lecture 6.
Introduction to Computing Dr. Nadeem A Khan. Lecture 18.
Section Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes.
Introduction to Computing Dr. Nadeem A Khan. Lecture 8.
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
Introduction to Computing Dr. Nadeem A Khan. Lecture 5.
Section 3.6 BUILT-IN FUNCTIONS involving numbers & strings.
Manipulating Strings.
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Copyright © 2001 by Wiley. All rights reserved. Chapter 3: Variables, Assignment Statements, and Arithmetic Variables Assignment Statements Arithmetic.
Fundamentals of Programming in Visual Basic
L7.1b Continuous Random Variables CONTINUOUS RANDOM VARIABLES NORMAL DISTRIBUTIONS AD PROBABILITY DISTRIBUTIONS.
Aloha Aloha What you see: What the computer sees: binary number columns binary number columns
Input & Output: Console
Week 2 - Monday.  What did we talk about last time?  Software development  Lab 1.
National Diploma Unit 4 Introduction to Software Development Data types, variables and constants.
Lecture 8 Visual Basic (2).
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
Manipulating Strings. What is a string? Data composed of text characters. The data is stored in consecutive bytes of memory. Each byte stores the ASCII.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
Chapter 8 - Visual Basic Schneider
Representing Characters in a computer Pressing a key on the computer a code is generated that the computer can convert into a symbol for displaying or.
Introduction to Programming Fundamentals of Programming in Visual Basic.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 9 Structures and Sequential Access Files.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Selection Part 2 Using Logical Operators, how strings are compared and random numbers.
Chapter 3 - Visual Basic Schneider. Private Sub cmdEvaluate_Click() Dim n As Single, root As Single n = 6.76 root = Sqr(n) picResults.Print root; Int(n);
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Introduction to Computing Dr. Nadeem A Khan. Lecture 21.
Microsoft Visual Basic 2005: Reloaded Second Edition
L7 – Assembler Directives
Chapter 6 Sub Procedures
Presenting information as bit patterns
Sub Procedures and Functions
Visual Basic: Week 5 Review User defined functions
Presentation transcript:

Introduction to Computing Dr. Nadeem A Khan

Lecture 9

Built-in Functions (Contd.) Fixed length string formatting: Fixed length string formatting: ► FunctionString Value Format$( , Format$(123, Format$(“ ”, Format$(“$1,234.56”, Format$(1/4,

Sub Text1_KeyPress(KeyAscii as Integer) statements statements End Sub ► Text1_KeyPress event will occur when Text1 has the focus and a key is pressed Text1 has the focus and a key is pressed The Keypress Event Procedure

Sub Text1_KeyPress(KeyAscii as Integer) statements statements End Sub ► Keyascii  is a variable (of type Integer)  gets the ANSI value of the pressed key  value is used to display the corresponding character in the Text1 at the end of this procedure The Keypress Event Procedure (Contd.)

The ANSI (ASCII) Code ► A 7 bit code representing one of the 95 characters (including space) ► Normally one byte is used to store this code

What will happen in these cases? Sub Text1_KeyPress(KeyAscii as Integer) Let KeyAscii =65 Let KeyAscii =65 End Sub Sub Text1_KeyPress(KeyAscii as Integer) Let KeyAscii =0 Let KeyAscii =0 End Sub The Keypress Event Procedure (Contd.)

Generating Random Numbers The function: Rnd The function: Rnd ► Generates a random number from 0 up to but not including 1 Picture1.Print Rnd‘print a different number each time Let numvar= Rnd‘a random value is assigned

Generating Random Numbers (Contd.) The function: Rnd The function: Rnd Display numbers from the set {1,2,3,4,5,6} randomly!

Generating Random Numbers (Contd.) The statement: Randomize Timer? The statement: Randomize Timer?

Generating Random Numbers (Contd.) The statement: Randomize Timer The statement: Randomize Timer Sub Command1_Click ( ) Rem Display a lottery number Picture1.Cls Randomize Timer Picture1.Print Int(10*Rnd); Picture1.Print Int(10*Rnd) End Sub

Read Chapter 4 completely