computer programming
TRANSCRIPT
Computer Programming
Program Concepts
Introduction
An
to
This lecture contains… Computer programsQbasic
- Features - Rules - Parts - Qbasic Editor screen Commands/ Keywords and their
functionsDevelopment cycleProgram Planning
Programming Language
In computer technology, It is a set of conventions in which instructions for the machine are written. There are many languages that allow humans to communicate with computers; C++, BASIC, and Java are some common ones.
Basic Cobol C, C++
Fortran Pascal ADA JAVA HTML
According to Sammet, over 200 programming languages were developed between1952 and 1972, but she considered only about 13 of them to be significant
>> Main Programming Languages
What is QBasic?QBASIC is a stripped-down version of QuickBasic that Microsoft released in 1991, which was included for free with MS-DOS 5 and later versions. It also comes packed-in with the Windows 95 and Windows 98 operating systems.
QBASIC is shareware. The latest version is Version 1.1.
About Qbasic… BASIC stands for Beginner’s All Purpose Symbolic Instruction Code. It was invented in 1963, at Dartmouth College, by the mathematicians John George Kemeny and Tom Kurtzas.
BASIC is an interpreter which means it read every line, translates it and lets the computer execute it before reading another. Each instruction starts with a line number.
FEATURES OF QBASIC
It is a user friendly language. It is widely known and accepted
programming language. It is one of the most flexible
languages, such as modification can easily be done in already existing program.
Language is easy since the variables can be named easily and uses simple English phrases with mathematical expressions.
QBASIC automatically checks syntax. QBASIC capitalizes the reserved words.
Rules Of QBasic
• 1) All QBasic programs are made up of series of
statements, which are executed in order in which they are
written.
• 2) Every statement should have at least one QBasic
command word. The words that BASIC recognizes are
called keywords.
• 3) All the command words have to be written using some
standard rules, which are called “Syntax Rules”. Syntax is
the grammar of writing the statement in a language.
Syntax Errors are generated when improper syntax is
detected.
Every programming language has a set of rules that have to e followed while writing a program, following are some rules of QBASIC LANGUAGE.
The Qbasic Editor Screen
QBASIC editor is the window where you write programs. The editor provides all the facilities to write programs and editing them.
• MENU BAR.— NAMES EACH MENU. WHEN YOU PRESS THE ALTT KEY, THE HIGHLIGHTED LETTER INDICATES WHICH KEY "PULLS DOWN" THAT MENU. VIEW WINDOW.— DISPLAYS YOUR PROGRAM'S TEXT. CURSOR.— SHOWS WHERE THE TEXT YOU TYPE WILL APPEAR. THE CURSOR APPEARS IN THE ACTIVE WINDOW. MOUSE CURSOR.— SHOWS CURRENT ON-SCREEN POSITION OF MOUSE (USE WITH MOUSE ONLY).
TITLE BAR.— SHOWS THE NAME OF THE PROGRAM OR PROCEDURE. MAXIMIZE BOX.— EXPANDS THE ACTIVE WINDOW TO FILL THE SCREEN (USE WITH MOUSE ONLY). SCROLL ARROW.— SCROLLS THE TEXT ONE CHARACTER OR ONE LINE AT A TIME (USE WITH MOUSE ONLY). SCROLL BOX.— SHOWS CURSOR'S RELATIVE POSITION WITHIN THE FILE OR PROCEDURE.
Menu Bar
View Windo
w
Mouse
Cursor
Cursor
Title Bar
Maximize Box
Scroll Arrow
Scroll Box
Parts
BOTTOM HALF OF QBASIC INVOCATION SCREEN
IMMEDIATE WINDOW.— • EXECUTES QBASIC STATEMENTS DIRECTLY; THEY NEED NOT BE ENTERED AS PART OF A PROGRAM.
CAPS LOCK AND NUM LOCK INDICATORS.— • C APPEARS WHEN THE CAPS LOCK KEY IS TOGGLED ON. NAPPEARS WHEN THE NUM LOCK KEY IS
TOGGLED ON. SCROLL BARS.—
• SCROLLS TEXT IN THE CURRENTLY ACTIVE WINDOW (USE WITH MOUSE ONLY).
REFERENCE BAR.— • CONTAINS REFERENCE INFORMATION. THE FIRST FIVE ITEMS ARE BUTTONS SHOWING A
FREQUENTLY USED SHORTCUT KEY AND THE CORRESPONDING MENU OR OPTION. CLICKING A BUTTON WITH THE MOUSE GIVES THE SAME RESULT AS PRESSING THE SHORTCUT KEY SHOWN IN
THE BUTTON. PRESSING ALT DISPLAYS FOUR DIFFERENT REFERENCE ITEMS.
WORDSTAR-STYLE COMMAND INDICATOR.— • ^Q APPEARS WHEN YOU ENTER CTRL+Q, A WORDSTAR-STYLE COMMAND. ^K APPEARS HERE WHEN
YOU ARE SETTING A PLACE MARKER (SEE SECTION 12.4, "USING PLACEMARKERS IN TEXT"). ^P APPEARS HERE WHEN YOU ARE ENTERING A LITERAL CHARACTER (SEE SECTION 12.6 , "ENTERING
SPECIAL CHARACTERS").
Run
It is possible to overwrite lines with the new statements, but if you want to write a totally new program use a NEW command.
Exiting QBasic In order to exit the QBASIC program SYSTEM command is used.
• is the command used to execute the program and get the output on the screen.
COMMAND/KEYWORDS IN QBASIC AND THEIR FUNCTIONS:
List-Used to list the
program on the screen
RUN-Used to execute the program
LList-Used to list the
program as a
hardcopy
LPrint-Used to get the
output of the
program on the
hardcopy
New-Used
to clear the
memory of the existing program
System-Used to take
you back to
dos prompt
Save-Used
to save the
program
Load-Used
to load the
program from the disk to the
memory
Commands
With the PRINT command, you can also print numbers to the screen. Delete the current program (unless you already have) and write the following:PRINT 555 (or ?555)<press Enter>Press F5 to run the program. The program outputs:555
There are also special functions
called “commands” (also called
“instructions”). A “command” tells
the QBasic interpreter to do
something
The PRINT command tells the
QBasic interpreter to print
something to the screen. In this
case, the interpreter printed “Hello
World!”.
TIP: Instead of typing PRINT you can enter a question
mark. For example:
?“Hello World!”
Menus
• access to drop down menus by:– using mouse– pressing ALT key highlights shortcut keys
e.g. F, E, V etc. to menus; highlighted letters in menu are shortcuts
• ESC key to return to View Screen
ALT + enter to maximise screenCtrl + break to stop a continuously looping program
Important keys
determine outputs - what is the question?
determine inputs - what is the user required to enter/ data available?
determine process - algorithm / mathematical formulasInput Process OutputAlgorithm
- step by step solution to the
problem
Steps in Planning the program
Analysis - define the program Design - plan the solution; consider
all ‘what if scenarios’ Code - translate into (QBasic)
language Test and Debug DOCUMENTATION!!!!!
Programming
Tools
• Flowcharts• Pseudocode• Top-down • charts
Flow charts
• represents the steps in the algorithm in a graphical manner
start
Pay rate = 6.25
Hours = 25
Gross pay = Pay rate * hours
Print Gross Pay
End
References• http://
ayushchoithram.wikispaces.com/QBasic+Introduction
• http://ayushchoithram.wikispaces.com/QBasic+Introduction
• http://chortle.ccsu.edu/QBasic/AppendixB/appendixB.html
• http://www.qbasic.net/
A Presentation By:
Leigh-ann Garrote
Aileen Jeanne Gumop-as
All Rights reserved 2015
#78 Brgy. Santiago, Binalonan Pangasinan
#05 Brgy. Sta. Catalina, Binalonan Pangasinan