This preview shows page 1. Sign up to view the full content.
Unformatted text preview: extended in virtually every available BASIC
dialect. Today, BASIC has many dialects including BASICA, QBASIC, and
Visual Basic. Microsoft's Visual Basic supports object-oriented features and
methods. Furthermore, note that although BASIC began as an interpreted
language, several new dialects of BASIC have added compilers. Microsoft's Quick
BASIC and Visual Basic produce compiled programs.
A BASIC program to compute and print the sum of 10 numbers is given in Figure
12.20. It can be observed from this example that a BASIC program is made up of a
series of statements. Each statement starts with a statement number and a key
word, followed in most cases by some type of action. For example, in the
statement, "40 LET S = S + N", 40 is the statement number, LET is the key word,
and S = S + N is the action. The first two statements of the program, which are
REM statements, are remarks being made for the purpose of explaining or
documenting a program step. They have no effect on the program logic. A
remark/comment statement must have a line number, the key word REM, and any
remark that the programmer wishes to make. In our example, the remark statement
was used to name the program. The two LET statements are assignment
statements. The READ and PRINT statements read input data and print output
result respectively. The FOR and NEXT statements control the loop that is meant
for adding the 10 numbers one-by-one. The two DATA statements in the program
are used to furnish the input data. The END statement stops the program.
REM PROGRAM TO COMPUTE
REM THE SUM OF 10 NUMBERS
10 LETS = 0
30 READ N
40 LET S = S + N
50 * NEXT I
60 PRINT "THE SUM OF GIVEN NUMBERS :
70 DATA 4, 20, 15, 32, 48
80 DATA 12, 3, 9, 14,44
Named after the famous seventeenth-century, French mathematician, Blaise
Pascal, this language was first developed in the year 1971 by Professor Nicklaus
Wirth of Federal Institute of Technology in Zurich, Switzerland. His main objective was to develop a language that can allow beginners to learn good
problem solving and programming practices. To meet this objective, Pascal was
developed based on the concepts associated with structured programming. That is,
it was d...
View Full Document
This document was uploaded on 04/07/2014.
- Spring '14