freebasic
Edit Entry
This entry lacks an abstract, basic information section, and entry classification. Please supplement relevant content to improve the entry! Edit Now >>
Table of Contents
1 Attributes
2 Features
3 Disadvantages
1 Attributes Edit
【Language】FreeBASIC, the dark horse in the BASIC language world
Users who have learned QuickBASIC can get started with the BASIC language,
Completely free and open source, can generate high-quality machine code, cross-platform,
FreeBASIC is like its name, free and based on the established BASIC syntax,
2 Features Edit
Easy to learn and use is its advantage, but it is not only simple, but also very powerful in function.
- Almost supports all original QB instructions, and has many additional functions
- Generates fast and high-quality machine code without relying on virtual machines such as VM
- Completely free, including source code, and the compiled program has no licensing issues
- Supports multiple platforms such as MS-DOS/Win32/Linux, and can also compile GUI programs
- Has support from many third-party function libraries (Allegro/SDL.. and DirectX/Win32API)
- Supports Unicode, making it very easy to use Chinese
- It is very easy to compile EXE/OBJ/LIB/DLL to be used with other languages
3 Disadvantages Edit
- Code optimization has not been fully completed
Official homepage
http://www.freebasic.net/
FBEdit http://fbedit.freebasic.net/
FBIde http://fbide.freebasic.net
FreeBASIC is a free and open-source 32-bit BASIC compiler. It can run on Windows (32-bit), protected-mode DOS, and Linux (x86) systems. It was originally developed as a code-compatible, free and open-source replacement for Microsoft QuickBASIC, but now it has rapidly grown into a powerful development tool. The default installation already includes the following function libraries: Allegro, SDL, OpenGL, Gtk, Windows API, etc.
In addition to being highly compatible with Microsoft QuickBASIC in terms of syntax, FreeBASIC has added some new features, such as pointers, unsigned data types, inline assembly, preprocessors, etc.
FreeBASIC is a self-hosting compiler (its compiler is written in FreeBASIC language), developed by V1ctor.
------------------------------------------------------------------------
BASIC
Edit Entry
This entry lacks a basic information section and entry classification. Please supplement relevant content to improve the entry! Edit Now >>
BASIC (Beginners' All-purpose Symbolic Instruction Code, also translated as Begic), meaning "Beginner's General Symbolic Instruction Code", is a programming language designed for beginners. In terms of microcomputers, because the BASIC language can give full play to the operating functions of microcomputers, BASIC has long become one of the main languages of microcomputers.
Table of Contents
1 Introduction
2 History
Early Stage
Microcomputer
Structured
Visual
3 Name
4 About
5 Basic Commands
6 Language Features
1 Introduction Edit
Beginner's All-purpose Symbolic Instruction Code (Beginner's General Symbolic Instruction Code), initially written as BASIC by the author, later widely called Basic by Microsoft. The BASIC language was created by professors John G. Kemeny and Thomas E. Kurtz of Dartmouth College in the mid-1960s. Due to its excellent intention and the simple and easy-to-learn basic characteristics of the BASIC language, it quickly became popular. Almost all small, micro and home computers, and even some large computers, provide users with the ability to write programs in this language. In terms of microcomputers, because the BASIC language can give full play to the operating functions of microcomputers, BASIC has long become one of the main languages of microcomputers.
With the rapid development of computer science and technology, especially the widespread use of microcomputers, computer manufacturers have continuously expanded the functions on the original BASIC, and various BASIC versions have emerged, such as TRS-80 BASIC, Apple BASIC, GWBASIC, IBM BASIC (that is, BASICA), True BASIC. At this time, BASIC has developed from an early small and simple learning language to a powerful use language. Many of its functions can already be compared with other excellent computer high-level languages, and some functions (such as drawing) even exceed other languages.
Generally, natural human languages have standard languages and dialects, and computer languages are also like this. Many computers have the BASIC language, but their syntax, rules, and functions are not exactly the same. The same computer may also have different versions of the BASIC language or different brands of BASIC languages produced by different software development companies. However, everyone has consistently inherited the basic form and spirit designed by the creators of BASIC, and respectively given unique design methods and added some functions.
2 History Edit
Early Stage
The language function was very weak, with very few statements, only 14 statements, and later developed to 17 statements, which is the so-called "basic BASIC". This period of BASIC language was mainly used on minicomputers and executed in compiled form.
Microcomputer
In the 1970s, BASIC developed into a widely used general language. It was also in this decade that the microcomputer was born. The first microcomputer equipped with the BASIC language was Bill Gates, the president of Microsoft Corporation. At that time, he was only 19 years old. Driven by Bill Gates' first microcomputer BASIC, various computers were successively equipped with the BASIC language. Due to different models, their extensions to the basic BASIC language were also different, leading to the situation that BASIC language programs could not be compatible with each other. The BASIC language in this period began to use the interpretation execution method, which facilitated users' maintenance of the program.
Structured
The idea of structured programming emerged in the 1970s. Its main idea is to try to make the program execute in the traditional writing order as much as possible, reduce the jump between statements, adopt modular design, and each module completes a relatively simple function. Structured programs can increase the readability of the program.
In the mid-1980s, the American National Standards Institute (ANSI) proposed a new BASIC standard draft based on the idea of structured programming. After that, some structured BASIC languages appeared, mainly Quick BASIC, True BASIC, etc. They not only fully meet the requirements of structured and modular programming, but also retain the advantages of easy learning, easy use, and easy maintenance of the BASIC language. At the same time, they provide both interpretation execution and compilation execution methods.
Visual
In the mid-1980s, Microsoft Corporation launched the Windows operating system, which provides a graphical user interface. Through the mouse, window, menu, etc., to control the computer, making the operation more intuitive and simple, and making it easier and more convenient to use the computer.
The BASIC language based on the Windows operating system is Visual BASIC (meaning "visual BASIC"), developed by Microsoft Corporation of the United States. It was launched by Microsoft Corporation in 1991 and is a powerful software development tool. With it, applications with a good user interface can be designed. Visual BASIC was highly valued as soon as it appeared, with great development potential. Bill Gates claimed: "Visual BASIC is the best example to meet the challenges of computer programming."
In 1975, Bill Gates founded Microsoft and successfully ported the compiler of the Basic language to the ALR computer using the Intel processor. When IBM selected Microsoft to create the PC operating system in 1982, it also selected Microsoft's Basic as its computer's ROM-Basic. Microsoft also included GW-BASIC, QBasic, and other then-best Basic interpreters in its released DOS operating system for free. Quick BASIC was launched by Microsoft Corporation in 1987.
In 1991, with the release of MS-DOS 5.0, Microsoft Corporation also launched a simplified version of Quick BASIC, QBASIC, and provided it to users for free as part of the operating system. Since the appearance of the Windows operating system, the graphical user interface (GUI) BASIC language (that is, Visual Basic) has been widely used.
Visual Basic.NET was launched in 2001
Visual Basic.NET 2003 was launched in 2003
Visual Basic 2005 was launched in Visual Studio 2005 on November 7, 2005.
The BASIC language was originally created in the form of an interpreter, and many different named versions have evolved, such as: BASICA, GW-BASIC, MBASIC, TBASIC, etc. Microsoft Corporation also launched QuickBASIC in the MS-DOS era and gradually improved it to have both interpretation and compilation translation methods. When Windows became popular in 1988, Microsoft Corporation launched Visual Basic for Windows, which became a unique easy-to-learn and use programming language in the Windows operating environment. Microsoft Corporation also specially developed Visual Basic for MSDOS for MS-DOS users. Microsoft's early rise was largely due to the BASIC language.
Programs compiled by Visual Basic 6.0 can run smoothly under Windows 7 and can also run smoothly under the latest operating system Windows 8 launched by Microsoft.
3 Name Edit
Beginner's All-purpose Symbolic Instruction Code (Beginner's General Symbolic Instruction Code), initially written as BASIC by the author, later widely called Basic by Microsoft.
The BASIC language was originally a high-level language created for college students on campus, with the purpose of making it easy for college students to use computers. Although the initial BASIC only had 16 statements, because BASIC was relatively easy to learn at that time, it quickly moved from the campus to the society and became the first choice language for beginners to learn computer programming.
In 1975, Bill Gates founded Microsoft and successfully ported the Basic language's compiler to the ALR computer using the Intel processor. When IBM selected Microsoft to create the PC operating system in 1982, it also selected Microsoft's Basic as its computer's ROM-Basic. Microsoft also included GW-BASIC, QBasic, and other then-best Basic interpreters in its released DOS operating system for free.
Visual Basic.NET was launched in 2001
Visual Basic.NET 2003 was launched in 2003
Visual Basic.NET 2005 was launched in Visual Studio.NET 2005 on November 7, 2005.
There is also Visual Basic.NET 2008 in Visual Studio.NET 2008
4 About Edit
BASIC was developed by American scientist Thomas Kurtz in May 1965. More than 10 years later, Bill Gates (the former president of Microsoft Corporation) ported it to the PC. For more than 30 years, the BASIC language has been the most widely used high-level language for beginners to learn computer languages. It can perform numerical calculations, drawing, playing music, and has very powerful functions, and it is very easy to learn.
5 Basic Commands Edit
PRINT: Display content or result
INPUT: Type in
LET: Assign value
GOTO: Unconditional transfer
FOR TO...NEXT: Loop
IF THEN ELSE: Condition
DO WHILE...LOOP: Conditional loop
END: End
RUN: Run
CLS: Clear screen
6 Language Features Edit
1. Simple and easy to learn: Most of the words used in the BASIC language are the original meaning or abbreviation of English words, and the writing of operation symbols and expressions is also similar to that in mathematics. There are only 17 standard BASIC statements.
2. Interactive: People can "communicate" with the computer through the keyboard and display screen. When running the program, the computer will display the syntax errors and the attributes of the errors in the program, allowing the user to modify them.
3. Wide application: It can not only perform scientific calculations but also data processing, etc.
4. Two execution methods: Interpretation method and compilation method. Among them, the interpretation method can run the program while entering it, which is very suitable for beginners.
BASIC is the abbreviation of Beginner's All-purpose Symbolic Instruction Code, meaning the Beginner's General Symbolic Instruction Code language. It was a language system designed by professors Thomas and John G. Kemeny of the United States on the basis of the Fortran language in 1964. This simple and easy-to-learn programming language only had 17 statements, 12 functions, and 3 commands at that time, which is generally called basic BASIC now.
--------------------------------------------------------------------------
quick basic
Edit Entry
This entry lacks an abstract and entry classification. Please supplement relevant content to improve the entry! Edit Now >>
Chinese Name Quick Basic
Nature BASIC variant
English Name Beginner's All-purpose Symbolic Instruction Code
Unit Microsoft Corporation of the United States
Table of Contents
1 Overview
2 Improvements
3 Common Syntax
Conditional Statements
Loop Structure Statements
Basic Statements
Variables
Simple Double Loop in the Application of Bubble Sort Program
Several Common Operation Statements and Functions
Exercises for Beginners
4 Shortcuts
5 Examples
1 Overview Edit
QBASIC is a variant of the BASIC (Beginner's All-purpose Symbolic Instruction Code) language, developed by Microsoft Corporation of the United States and launched with MS-DOS 5.0 in 1991. It cannot be compiled into an independent executable file. The source code is first compiled into intermediate code in the integrated development environment (IDE), and then the intermediate code is interpreted and executed in the IDE. It is designed to replace GW-BASIC and is integrated in MS-DOS 5.0 and its higher versions (including Windows 95). QBASIC is based on QuickBASIC 4.5 previously launched by Microsoft, but the compilation and connection parts of the latter are removed.
Microsoft no longer integrates QBASIC in newer versions of Windows. However, users of Windows 98 can find it in the \\TOOLS\\OLDMSDOS directory on the CD, and in Windows 95, it is stored in the \\OTHER\\OLDMSDOS directory. Microsoft's technical support for it is only valid for MS-DOS licensed users.
QBASIC has a commendable integrated development environment and a powerful integrated debugger, which all made people耳目一新 at that time. Until today, QBASIC is still the theme of many programming books for beginners.
2 Improvements Edit
Similar to Quick BASIC but different from earlier implementation versions of Microsoft's other BASIC, QBASIC is a structured programming language. Compared with GW-BASIC, the main improvements of QBASIC are:
Expanded variable and constant types
Variable name length: 40 characters
Added long integer and fixed-length character type variables
Can define numerical constants and string constants
Subroutines and functions as separate modules
No need for line numbers
Note: Quick BASIC is abbreviated as QB, which is a compiled language; qbasic is an interpreted language, and has the same syntax as Quick BASIC. At the same time, for the sake of time, the PRINT statement in QBASIC can be directly replaced with?.
3 Common Syntax Edit
Conditional Statements
Line if statement: IF condition THEN statement group ELSE statement group 2
Block if statement
IF condition THEN
statement group
ELSE
statement group 2
END IF
The IF statement can also be used in this way
IF condition THEN
statement group
ELSEIF condition THEN
statement group 2
END IF
Multi-branch statement SELECT usage:
SELECT CASE variable or string
CASE situation 1
statement group
CASE situation 2
statement group 2
END SELECT
Loop Structure Statements
1. Counting loop
for control variable = initial value to final value 'step statement can be present or not. If there is no step statement, the step size is +1
statement body
next control variable
2. While loop
There are two formats:
(1)
WHILE condition
loop body
WEND
(2)
DO WHILE condition
loop body
LOOP
3. Until loop
DO
loop body
LOOP UNTIL condition
Basic Statements
CLS: That is, Clean the screen, clear the screen
Input statement: input "display content", variable name list
Or change "," to ";", after modification, there will be an extra "?" when entering
Output statement: print "display content", variable name list 1, "display content", variable name list 2...
When changing, the space between the two contents is 1 space, otherwise it is about 14 spaces, and the last one without a semicolon is a line break.
Assignment statement: assigned variable = expression 'let can be present or not
Definition of one-dimensional array: dim variable name (subscript)
Definition of two-dimensional array: dim variable name (subscript 1, subscript 2)
Code example (assignment, summation operation, and display result)
A=10
B=20
C=A+B
Print C
END
Variables
Variable length is less than or equal to 40, no keywords are allowed, such as Let
Numbers: such as 15%, -32768, 215654#, 2.0158e+15, 8.545646d+20, -18.75, etc. Variable names are such as a variable name
Strings: such as "15%", "abc", etc. Variable names are such as a$ variable name
Supplement: In QB, geometric drawing can also be done. The specific usage is as follows (see the internal help of QB for details)
SCREEN 12'639*479 16-color graphic mode
CIRCLE(100,150),10,4'Draw a circle with radius 10 at x coordinate 100 and y coordinate 150 with color 4 (red).
SYSTEM
Simple Double Loop in the Application of Bubble Sort Program
CLS
DIM n AS INTEGER
INPUT n
DIM a(n)
FOR i = 1 TO n
INPUT a(i)
NEXT i
FOR i = 1 TO n
FOR j=1 TO i-1
IF a(j) > a(j+1) THEN SWAP a(j), a(j+1)
NEXT j
NEXT i
FOR i = 1 TO n
PRINT a(i)
NEXT i
END
Several Common Operation Statements and Functions
Addition operation:
Sum of AB = A+B
Subtraction operation:
Difference of AB = A-B
Multiplication operation:
Product of AB = A*B
Division operation
Quotient of AB = A/B
Exponentiation operation
A to the power of B = A^B
Square root operation
Square root of A = SQR(A)
Swap variables
SWAP value A, value B
Exercises for Beginners
1. Input 20 numbers, find their maximum, minimum and average.
2. Among 1-500, find all integers that can simultaneously satisfy being divided by 3 with a remainder of 2, divided by 5 with a remainder of 3, and divided by 7 with a remainder of 2;
3. If a number is the same when read from the left and the right, it is called a palindrome number. For example, 686 is a palindrome number. Find all palindrome numbers within 1000.
4. Given the sequence 1, 5, 12, 22, 35,... Find the 20th number.
5. Input an integer greater than 1, and print out its prime factorization. For example, if 75 is input, print: "75=3*5*5".
6. Input 10 positive integers, calculate their sum and sum of squares;
7. Input 20 integers, count the number of positive, negative and zero;
8. Output numbers between 1-999 that can be divided by 3 and have at least one digit as 5;
9. There is a six-digit number, its units digit is 7. Now move the units digit to the first digit (hundred thousands place), and the other digits remain unchanged to get a new six-digit number. If the new number is 4 times the old number, find the original six-digit number.
10. There is such a six-digit number labcde. Multiply it by 3 to become abcdel. Program to find this number.
11. Try to find 6 prime numbers that are less than 160 and form an arithmetic sequence.
1-1/3+1/5-1/7+……until the absolute value of a certain term is less than 10^-6
Additional:
We use a positive integer sequence to represent the height of a place. When the height of a place is a sequence that rises one by one,
we call it a staircase. For example, 4, 5, 6, 7, 8 is a staircase with a length of 5. Now given a positive integer sequence,
please find its first longest staircase and output it. If there is no staircase, output "No".
Example of running result:
Please enter the length of the sequence: 8
Please enter the sequence: 2 3 2 3 4 4 5 6
The result is 2 3 4
4 Shortcuts Edit
Ctrl+C+Break: Interrupt the running program;
F5: Run the program;
Shift+F5: Re-run the program from the first statement;
F4: When the program is interrupted and running, view the running result screen, and press F4 again to switch back to the code screen;
F1: Get help.
F8: Step by step run
F9: Breakpoint (same as QB stop statement, press F5 to continue running)
5 Examples Edit
【1】A kilogram of mushrooms in the vegetable market is 7.5 yuan. Write a program to input the weight from the keyboard, and the computer automatically calculates the total price.
INPUT X
zj=7.5*X
PRINT zj
END
【2】High-precision multiplication program
CLS
INPUT a$
INPUT b$
la = LEN(a$)
lb = LEN(b$)
lc = la + lb
DIM a(la), b(lb), c(lc)
FOR i = 1 TO la
a(i) = VAL(MID$(a$, la + 1 - i, 1))
NEXT i
FOR i = 1 TO lb
b(i) = VAL(MID$(b$, lb + 1 - i, 1))
NEXT i
FOR i = 1 TO la
FOR j = 1 TO lb
x = a(i) * b(j): w = i + j - 1
c(w) = c(w) + x MOD 10
c(w + 1) = c(w + 1) + c(w) \ 10 + x \ 10
c(w) = c(w) MOD 10
NEXT j
NEXT i
DO WHILE c(lc) = 0
lc = lc - 1
LOOP
FOR i = lc TO 1 STEP -1
PRINT USING "#"; c(i);
NEXT i
END
-----------------------------------------------------
gw-basic
Edit Entry
This entry lacks an abstract image and entry classification. Please supplement relevant content to improve the entry! Edit Now >>
GW-BASIC is a dialect version of the advanced programming language BASIC. Regarding the meaning of GW, there are currently three statements. One is that it is named after Greg Whitten, an early programmer of Microsoft. One is that it is named after Gates, William, the founder of Microsoft. There is also a statement that it is a joke name given by the developers, gee-whiz (two English onomatopoeias, similar to the sound of yelling livestock in Chinese). One thing is certain, this version of BASIC was first developed by Microsoft for Compaq in 1984. In November of this year, Microsoft first provided OEM versions of DOS for computer manufacturers other than IBM. GW-BASIC was introduced as a component of MS-DOS. First provided OEM versions of DOS for computer manufacturers other than IBM. GW-BASIC was introduced as a component of MS-DOS.
Chinese Name gw-basic
Time 1984
Nature Programming language
Belongs to Microsoft
Table of Contents
1 Historical Status
2 Features
3 Syntax
1 Historical Status Edit
The development of Basic has gone through three stages:
Unstructured Basic language, such as: gw-Basic, MS Basic
Structured Basic language, such as: True Basic, Turbo Basic, Quick Basic
Object-oriented programming language, that is, Visual Basic
gw-basic belongs to unstructured basic, that is, the earliest basic language, without loop and while loop statements, and has great limitations.
2 Features Edit
GW-BASIC is completely compatible with BASICA provided by Microsoft for IBM PC. The difference is that the latter depends on the BASIC interpreter in ROM, while the former does not need it. Therefore, GW-BASIC can run on many IBM PC compatible machines, which expands its scope of use with the promotion of PC compatible machines. The first widely circulated GW-BASIC version number is 2.0, and the last released GW-BASIC version number is 3.23, probably in 1988. From then on, unless otherwise specified, the GW-BASIC we generally refer to refers to this version.
GW-BASIC runs slowly, which is largely because it is an interactive development tool - this development model was first proposed by Dartmouth University, the birthplace of BASIC. Like many early BASIC dialects, GW-BASIC lacks many syntactic components required for structured programming, but it is flexible enough. In addition, it has many drawing statements and some simple sounding statements, which are enough for a programmer to use it to develop a simple game software, commercial software or such things. It can run on most PCs, which provides a cheap way for those who want to become programmers to learn how to program.
3 Syntax Edit
GW-BASIC has a simple integrated development environment (IDE). All program lines must have a line number, and statements without line numbers are considered commands that need to be executed immediately. In the user interface, except for the function shortcut key description at the bottom of the screen and the copyright statement at the top, the other parts are used to display and write statements. The standard save format of the source file is a unique binary compression format of GW-BASIC, but it also provides an option that allows developers to save the source file in ASCII text file format. The GW-BASIC IDE provides the following common commands: RUN (execute the current source code), LOAD (load the source code from the disk), SAVE (save the source code to the disk), LIST (display the content of the opened source file), SYSTEM (return to the operating system). They can all appear on the source program code line, but except for SYSTEM, the above usage is still quite rare.
As mentioned earlier, GW-BASIC has very poor support for structured programming methods, so it is a great improvement for GW-BASIC programmers to be able to write programs with good structure with it. In GW-BASIC, the IF/THEN/ELSE conditional statement must be written in one line, although the WHILE/WEND has allowed multiple lines of code to be included; custom functions can only be written in the form of a one-line statement like DEF FNf(x) = <mathematical function about x> (for example, DEF FNLOG(base,number)=LOG(number)/LOG(base)); variables are usually determined by a type symbol at the end of the variable name: A$ means it is a string, A% means it is an integer, etc.; by using keywords such as DEFINT, DEFSTR, etc., the default type can be defined for a group of variables using the same first letter; the type of other variables is defaulted to single-precision floating point number.
Many GW-BASIC programmers are untrained, and they often cannot see the benefits of writing simple-structured programs, so there is a phenomenon of abuse of the GOTO statement. They are often unwilling to use structured statements that can perform the same function. See spaghetti code.
GW-BASIC supports game joystick and light pen input devices, but not mice. It can read and write disk files, LPT ports and COM ports, and can also handle port event traps, but cannot handle tape devices. It can also drive the standard built-in speaker of IBM PC and its compatible machines to make sounds by using the PLAY statement or SOUND statement.