Microsoft Office Tutorials and References
In Depth Information
F.2 Visual Basic
awaiting processing by the computer. The student would simply have to wait for the results—there
were no PCs in the 1960s!)
The first version of BASIC was very simple; indeed, it was primitive. For example, it had only
one data type: floating-point. (Data types are discussed in Chapter 5 . ) Since then BASIC has made
tremendous strides as a personal computer programming language, due mostly to the embrace of
the language by Microsoft.
Even to this day, however, the BASIC language, and its offshoot Visual Basic, do not get much
respect among computer scientists or academicians. The BASIC language gets a bad rap on two
fronts. First, it is generally considered a weak language in the sense that it does not provide very
much control over the computer's hardware (or operating system), at least as compared to other
languages such as C. Second, BASIC has a reputation for not "forcing" (or in some cases even
allowing) programmers to use good programming style.
For comparison with some other languages, here is a BASIC program that asks the user for some
numbers and then returns their average. Lines beginning with an apostrophe are comment lines
that are ignored by the computer.
' BASIC program to compute the average
' of a set of at most 100 numbers
' Ask for the number of numbers
INPUT "Enter the number of numbers: ", Num
' If Num is between 1 and 100 then proceed
' IF Num > 0 AND Num <= 100 THEN
Sum = 0
' Loop to collect the numbers to average
FOR I = 1 TO Num
' Ask for next number
INPUT "Enter next number: ", NextNum
' Add the number to the running sum
Sum = Sum + NextNum
' Compute the average
Ave = Sum / Num
' Display the average
PRINT "The average is: "; Ave
F.2 Visual Basic
Microsoft took the BASIC programming language to new heights when it developed Visual Basic.
In the early 1990s, Microsoft faced a dilemma. Windows was (and is) a considerably more
complex operating system than DOS, so much so that only professional programmers could
effectively use Microsoft's main programming tool for creating Windows-based applications—the
Microsoft Windows SDK, which is based on the C language. (These days, this tool has given way
Search JabSto ::

Custom Search