Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
22 views

L6 - Computer Programming

The document discusses computer programming and its fundamental elements. It defines programming, discusses the basic concepts like variables, data types, operators, and control structures. It also differentiates between low-level and high-level programming languages and enumerates examples of high-level languages.

Uploaded by

Elle Hwang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

L6 - Computer Programming

The document discusses computer programming and its fundamental elements. It defines programming, discusses the basic concepts like variables, data types, operators, and control structures. It also differentiates between low-level and high-level programming languages and enumerates examples of high-level languages.

Uploaded by

Elle Hwang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Mary Grace D.

Matias
Computer Engineering Department
College of Engineering
• Define computer programming
• Discuss the fundamental elements of programming
• Differentiate between the types of programming languages
• Enumerate examples of high level programming languages
• Get familiarized with the VBA environment
• is a step by step process of designing and developing various sets of computer
programs to accomplish a specific computing outcome.
• Programming Environment • Loops
• Basic Syntax • Numbers
• Data Types • Characters
• Variables • Arrays
• Keywords • Strings
• Basic Operators • Functions
• Decision Making • File I/O
• a procedure or formula used for solving a problem.
• based on conducting a sequence of specified actions in which these actions
describe how to do something.
• an informal way of programming description that does not require any strict
programming language syntax or underlying technology considerations.
• used for creating an outline or a rough draft of a program.
Computing for the area of a triangle

1. Get the base


2. Get the height
3. Multiply the base and the height
4. Divide the product by two
5. Write the result
6. Write the unit
You will need the following setup to start with Low-Level Language
programming using any programming language. - 0s and 1s
- Directly understood by the
computer
• A text editor to create computer programs.
• A compiler to compile the programs into binary High-Level Language
format. - Understood by human but
not by computer
• An interpreter to execute the programs directly. - Translated to LLL/machine
language using compilers
- ex: Java, Python, Visual Basic
Main Window

Form
Designer
Project
Explorer

Tool Box

Properties
Window
Code
Window
Title Bar

Menu Bar
Tool Bar
Combo Box List Box
Text Box Check Box
Label
Option Button
Pointer

Toggle Button

Frame
RefEdit
Command Button

Tab Strip Image


MultiPage Spin Button
Scroll Bar
Option Button

Form

Picture
Frame

Label
Button

Combo Box Text Box


This is where the tools
are placed.

Forms represent the


windows that comprise
the totality of the
application.
Object Event
Displays the project files.
Type Description

Boolean Logical True or False

Byte Whole numbers from 0 to 255 (unsigned)

Char (single character) Single alphanumeric character

String Alphanumeric values

Date 0:00:00 (midnight) on January 1, 0001 through


11:59:59 PM on December 31, 9999
Type Description

Integer Whole numbers from -32, 768 to 32, 767

Long Large whole numbers from –(2x109) to +(2x109)

Currency Numbers that can be adjusted to decimal places

Single Floating point up to 7 significant figures

Double Floating point up to 14 significant figures

Variant Holds any types of values


• used to store values that may vary and change in a computer program.
• can be divided into 2 types: numeric (holds numbers) and string (holds
alphanumeric texts).

NAMING VARIABLES
• Should not exceed 255 characters
• Cannot use reserved words in VB
• Case sensitive
SCOPE OF VARIABLES

• Can be local to the procedure or local to the whole form.


• Variables local to a procedure can be used only in that procedure and are
declared after a DIM reserve word.

• Variables may also be declared as public or private.


Public - visible to all code inside the module and all code outside
the module, essentially making it global.
Private - visible only to code inside the module.
• Refer to fixed values.
• Can also be local or global, private or public.
Assumptions: B = 2, C = 5, D = 7
Operator Description Example
Mathematical Result
Statement
^ Exponential Notation A=B^2 A=4
* Multiplication A=B*C A = 10
/ Division A=D/B A = 3.5
\ Integer Division A=D\B A=3
Mod Modulo division (remainder) A = D mod B A=1
+ Addition A=B+C+D A = 14
- Subtraction A=B-C A = -3
Function Description Example
Mathematical Statement Result
Abs Gets the absolute value A = ABS (-87) A = 87
Sgn Gets the sign of value (1 pos, 0 neg) A = SGN (-87) A= 0
Fix Gets the truncated value A = FIX (2.16) A=2
Sqr Gets the square root A = SQR (9) A=3
Log Gets the natural logarithm A = LOG (1) A=0
Sin Gets the sine of angle in radians A = SIN (90) A = 0.8934
Cos Gets the cosine of angle in radians A = COS (90) A = 0.4481
Tan Gets the tangent of angle in radians A = TAN (90) A = -1.9952

You might also like