Note that although the code is included on this page, there are links you can click on that will allow you to download the files in .BAS (QBasic v1.1) format. If any problems arise, feel free to E-Mail John at jpp22@email.byu.edu. Also, feel free to edit these programs and do whatever you want with them (they are public domain)!
For those using Microsoft® operating systems (MS-DOS, Windows, etc.), you can download the "official" QBasic (v1.1) from the following address: http://www.microsoft.com/windows/download/olddos.exe. (It is included in an archive of old MS-DOS utilities.)
For those using other operating systems, there are many "unofficial" compilers available. Search the Internet and you'll find a number of them.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1997.
' Some source taken from Harper & Row
' Geometry by Max A. Sobel, pub. Scribner
' Laidlaw, NY.
CLS ' Clears the screen.
10 PRINT "First angle";
20 PRINT INPUT A
30 IF A > 180 THEN 10
40 PRINT "Second angle";
50 INPUT B
60 IF (A + B) > 180 THEN 40
70 LET C = 180 - (A + B)
80 PRINT "Third angle = "; C
END ' End of program.
Download the program.
Back to top.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1997.
'
' Some source taken from Harper & Row
' Geometry by Max A Sobel, pub. Scribner
' Laidlaw, NY.
Start:
CLS
INPUT "Degrees in angle"; D
IF D <= 0 THEN GOTO Start
IF D >= 180 THEN GOTO Start
IF D < 90 THEN GOTO Acute
IF D = 90 THEN GOTO Right
PRINT D; " is an Obtuse Angle.": GOTO 100
Right:
PRINT D; " is a Right Angle.": GOTO 100
Acute:
PRINT D; " is an Acute Angle.": GOTO 100
100:
INPUT "Another (Y/N)"; YN$
IF YN$ = "y" THEN GOTO Start
IF YN$ = "Y" THEN GOTO Start
IF YN$ = "n" THEN GOTO Ending
IF YN$ = "N" THEN GOTO Ending
Ending:
END ' End of program.
Download the program.
Back to top.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1997.
'
' Some source taken from Harper & Row
' Geometry by Max A. Sobel, pub. Scribner
' Laidlaw, NY.
10 CLS
20 INPUT "Measure of Angle A"; A
30 IF A <= 0 THEN 10
40 IF A >= 180 THEN 10
50 INPUT "Measure of Angle B"; B
60 IF B <= 0 THEN 50
70 IF B >= 180 THEN 50
80 LET E = (A + B)
90 PRINT "Exterior angle = "; E
100 INPUT "Another (Y/N)"; YN$
110 IF YN$ = "Y" THEN GOTO 10
120 IF YN$ = "y" THEN GOTO 10
130 IF YN$ = "N" THEN GOTO 150
140 IF YN$ = "n" THEN GOTO 150
150 END
Download the program.
Back to top.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1997.
'
' Some source taken from Harper & Row
' Geometry by Max A. Sobel, pub. Scribner
' Laidlaw, NY.
10 CLS
11 INPUT "How many sides does the polygon have"; I
12 IF I < 3 THEN BEEP: GOTO 11
13 LET Z = INT(I)
20 PRINT
30 PRINT "No. Sides", "Angle Sum"
40 PRINT "---------", "---------"
50 FOR N = 3 TO Z
60 LET S = 180 * (N - 2)
70 PRINT N, S
80 NEXT N
90 PRINT
100 INPUT "Another (Y/N)"; YN$
110 IF YN$ = "Y" THEN GOTO 10
120 IF YN$ = "y" THEN GOTO 10
130 IF YN$ = "N" THEN GOTO 150
140 IF YN$ = "n" THEN GOTO 150 ELSE BEEP: GOTO 100
150 END
Download the program.
Back to top.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1997.
'
' Some source taken from Harper & Row
' Geometry by Max A. Sobel, pub. Scribner
' Laidlaw, NY.
10 CLS
20 PRINT "Enter lengths of sides"
30 PRINT "of right triangle, legs"
40 PRINT "first. Enter a zero for"
50 PRINT "the unknown side."
55 PRINT
60 INPUT "What is the length of Leg 1"; A
70 INPUT "What is the length of Leg 2"; B
80 INPUT "What is the length of the hypotenuse"; C
90 If A < 0 THEN BEEP: GOTO 60
100 IF B < 0 THEN BEEP: GOTO 70
110 IF C < 0 THEN BEEP: GOTO 80
120 IF A = 0 THEN GOTO 200
130 IF B = 0 THEN GOTO 170
140 LET C = SQR(A * A + B * B)
150 PRINT "Hypotenuse = "; C
160 GOTO 220
170 LET B = SQR(C * C - A * A)
180 PRINT "Unknown leg = "; B
190 GOTO 220
200 LET A = SQR(C * C - B * B)
210 PRINT "Unknown leg = "; A
220 INPUT "Another (Y/N)"; YN$
230 IF YN$ = "Y" THEN GOTO 10
240 IF YN$ = "y" THEN GOTO 10
250 IF YN$ = "N" THEN GOTO 270
260 IF YN$ = "n" THEN GOTO 270
270 END
Download the program.
Back to top.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1998.
'
' Some source taken from Harper & Row
' Geometry by Max A. Sobel, pub. Scribner
' Laidlaw, NY.
5 CLS
10 PRINT "Input coordinates of Point 1."
15 INPUT "X1 = "; X1
20 INPUT "Y1 = "; Y1
30 PRINT "Input coordinates of Point 2."
35 INPUT "X2 = "; X2
40 INPUT "Y2 = "; Y2
50 LET M1 = ((X1 + X2) / 2)
60 LET M2 = ((Y1 + Y2) / 2)
70 PRINT "Midpoint = ("; M1; ", "; M2; ")"
80 LET D = SQR(((X2 - X1) ^ 2) + (Y2 - Y1) ^ 2)
90 PRINT "Distance = "; D
100 IF X1 = X2 THEN 140
110 LET M = ((Y2 - Y1) / (X2 - X1))
120 PRINT "Slope = "; M
130 GOTO 150
140 PRINT "Slope is undefined."
150 INPUT "Another (Y/N)"; YN$
160 IF YN$ = "Y" THEN GOTO 5
170 IF YN$ = "y" THEN GOTO 5
180 IF YN$ = "N" THEN GOTO 200
190 IF YN$ = "n" THEN GOTO 200 ELSE BEEP: GOTO 150
200 END
Download the program.
Back to top.
' Programmed by John Paul Pruess.
' Completed on July 18th, 1997.
Start:
CLS
LET P = 3.14159
PRINT "1. Volume"
PRINT "2. Total Area"
PRINT
INPUT "What is your selection"; S
LET S2 = INT(S)
IF S2 < 1 THEN BEEP: GOTO Start
IF S2 > 2 THEN BEEP: GOTO Start
IF S2 = 2 THEN GOTO TotalArea
IF S2 = 1 THEN GOTO Volume
Volume:
CLS
INPUT "How long is the radius"; R
INPUT "How tall is the cylinder"; H
LET V = (P * H * (R ^ 2))
PRINT "The volume = "; V
GOTO Again
TotalArea:
CLS
INPUT "How long is the radius"; R
INPUT "How tall is the cylinder"; H
LET T = 2 * P * R (H + R)
PRINT "The total area = "; T
GOTO Again
Again:
PRINT
INPUT "Another (Y/N)"; YN$
IF YN$ = "Y" THEN GOTO Start
IF YN$ = "y" THEN GOTO Start
IF YN$ = "N" THEN GOTO 200
IF YN$ = "n" THEN GOTO 200
200 END
Download the program.
Back to top.
Take the quiz on QBasic geometry programs. The quiz is very useful for either review or to see if you've really got the topic down.