basic1.bas
· 819 B · QBasic
原始文件
10 PRINT "Top 10 BASIC Features"
20 PRINT "1. PRINT - Displays output on the screen"
30 PRINT "2. LET - Assigns values to variables"
40 LET myVar = 5
50 PRINT "3. INPUT - Gets user input"
60 INPUT "Enter your name"; name$
70 PRINT "Hello ";name$
80 PRINT "4. IF/THEN - Makes decisions"
90 INPUT "Enter a number"; num
100 IF num > 5 THEN PRINT "The number is greater than 5"
110 PRINT "5. FOR/NEXT - Loops"
120 FOR i = 1 TO 5
130 PRINT i
140 NEXT
150 PRINT "6. FUNCTIONS"
160 PRINT SQR(4)
170 PRINT "7. COMMENTS - Notes in code"
180 ' This prints hello
190 PRINT "Hello"
200 PRINT "8. STRINGS"
210 PRINT "My string"; "abc"
220 PRINT "9. ARRAYS - Store lists of data"
230 DIM scores(5)
240 scores(0) = 5
250 PRINT scores(0)
260 PRINT "10. RANDOMIZE/RND - Generate random numbers"
270 RANDOMIZE TIMER
280 PRINT RND
1 | 10 PRINT "Top 10 BASIC Features" |
2 | 20 PRINT "1. PRINT - Displays output on the screen" |
3 | 30 PRINT "2. LET - Assigns values to variables" |
4 | 40 LET myVar = 5 |
5 | 50 PRINT "3. INPUT - Gets user input" |
6 | 60 INPUT "Enter your name"; name$ |
7 | 70 PRINT "Hello ";name$ |
8 | 80 PRINT "4. IF/THEN - Makes decisions" |
9 | 90 INPUT "Enter a number"; num |
10 | 100 IF num > 5 THEN PRINT "The number is greater than 5" |
11 | 110 PRINT "5. FOR/NEXT - Loops" |
12 | 120 FOR i = 1 TO 5 |
13 | 130 PRINT i |
14 | 140 NEXT |
15 | 150 PRINT "6. FUNCTIONS" |
16 | 160 PRINT SQR(4) |
17 | 170 PRINT "7. COMMENTS - Notes in code" |
18 | 180 ' This prints hello |
19 | 190 PRINT "Hello" |
20 | 200 PRINT "8. STRINGS" |
21 | 210 PRINT "My string"; "abc" |
22 | 220 PRINT "9. ARRAYS - Store lists of data" |
23 | 230 DIM scores(5) |
24 | 240 scores(0) = 5 |
25 | 250 PRINT scores(0) |
26 | 260 PRINT "10. RANDOMIZE/RND - Generate random numbers" |
27 | 270 RANDOMIZE TIMER |
28 | 280 PRINT RND |
29 |