Weekly Qbasic and Qb64 Lesson Topics
June 27, 2017, 03:54:04 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
   Home   Help Search Arcade Links Staff List Login Register  

Pages: [1] 2 3 ... 10
 1 
 on: March 11, 2017, 04:43:12 pm 
Started by WB Brown - Last post by WB Brown
10 REM PRIME/FACTORS
20 REM William B. Brown
30 REM 223 Harper Ridge Place
40 REM Antioch, TN 37013-3722
50 REM (573) 552-6822
60 REM COPYRIGHT July 1996, March 2017 by William B. Brown.
63 REM This program CANNOT be sold for any purpose without the
64 REM express written purpose of the author.
70 S$ = "ONLY WHOLE NUMBERS GREATER THAN ZERO"
80 E$ = "END NUMBER MUST BE EQUAL TO OR GREATER THAN THE START NUMBER"
90 CLS: PRINT: PRINT: PRINT "                               PRIMES AND FACTORS":
91 PRINT: PRINT "              COPYRIGHT July 1996, March 2017 by William B. Brown.":
92 PRINT "        This program CANNOT be sold for any purpose without the EXPRESS";
93 PRINT "                       written permission of the author.";
94 PRINT "                              All rights reserved.":
95 REM MAIN MENU
100 PRINT: PRINT "  (1) FIND THE PRIME FACTORS OF ONE NUMBER"
120 PRINT: PRINT "  (2) FIND THE PRIME FACTORS OF A RANGE OF NUMBERS"
140 PRINT: PRINT "  (3) TEST ONE NUMBER FOR PRIME"
150 PRINT: PRINT "  (4) FIND THE PRIMES IN A RANGE OF NUMBERS"
170 PRINT: PRINT "  (5) QUIT THE PROGRAM"
180 PRINT: PRINT: INPUT "TYPE THE NUMBER OF YOUR SELECTION"; Q
190 ON Q GOTO 810, 210, 960, 360, 1150
200 GOTO 90
205 REM FACTORS OF A RANGE OF NUMBERS
210 CLS: PRINT: PRINT: PRINT: PRINT "FIND THE FACTORS OF A RANGE OF NUMBERS"
220 PRINT: PRINT: PRINT: INPUT "TYPE S FOR SCREEN  P  FOR PRINTER "; T$
230 IF T$ = "S" OR T$ = "s" THEN PS = 0: GOTO 260
240 IF T$ = "P" OR T$ = "p" THEN PS = 1: GOTO 310
250 GOTO 210
260 GOSUB 550
270 CLS: PRINT: PRINT: PRINT: PRINT "FINDING ALL FACTORS OF THE NUMBERS BETWEEN"; SN; "AND"; EN; ".": PRINT: PRINT
290 GOSUB 610
300 PRINT "FINISHED": GOTO 770
310 GOSUB 550
330 LPRINT "FACTORS OF THE NUMBERS BETWEEN "; SN; " AND "; EN: LPRINT
335 PRINT "FACTORS OF THE NUMBERS BETWEEN "; SN; " AND "; EN: PRINT
340 GOSUB 1300
350 LPRINT: LPRINT "FINISHED": PRINT: PRINT "FINISHED": GOTO 770
355 REM TEST A RANGE OF NUMBERS FOR PRIMES
360 CLS: PRINT: PRINT: PRINT: PRINT "FIND THE PRIMES IN A RANGE OF NUMBERS"
370 PRINT: PRINT: PRINT: INPUT "TYPE S FOR SCREEN  P FOR PRINTER "; T$
380 IF T$ = "S" OR T$ = "s" THEN SP = 0: GOTO 410
390 IF T$ = "P" OR T$ = "p" THEN SP = 1: GOTO 460
400 GOTO 360
410 GOSUB 550
420 CLS: PRINT: PRINT: PRINT: PRINT "FINDING ALL PRIME NUMBERS BETWEEN"; SN; "AND"; EN; ".": PRINT: PRINT
440 GOSUB 700
450 PRINT: GOTO 770
460 GOSUB 550
480 LPRINT "ALL THE PRIME NUMBERS BETWEEN "; SN; " AND "; EN: LPRINT
485 PRINT "ALL THE PRIME NUMBERS BETWEEN "; SN; " AND "; EN: PRINT
490 GOSUB 700
500 LPRINT: LPRINT: LPRINT "FINISHED": PRINT: PRINT: PRINT "FINISHED": GOTO 770
510 IF FP <> 2 THEN PRINT FP; "*";: N = N / FP: RETURN
520 N = N / FP: IF N / FP = INT(N / FP) THEN PRINT FP; "*";: RETURN
530 IF N <> FP AND N <> 1 THEN PRINT FP; "*";: RETURN
540 PRINT FP;: RETURN
545 REM RANGE OF NUMBERS ENTRY
550 PRINT: PRINT: PRINT: INPUT "ENTER START NUMBER"; SN: N1 = SN
560 IF SN < 1 OR INT(SN) <> SN THEN PRINT: PRINT S$: GOTO 550
570 PRINT: PRINT: PRINT: INPUT "ENTER ENDING NUMBER (< 10,000,000)"; EN
580 IF EN < 1 OR INT(EN) <> EN THEN PRINT: PRINT S$: GOTO 570
590 IF EN < SN THEN: PRINT: PRINT E$: GOTO 550
600 R = SN: RETURN
605 REM FACTOR FINDER-SCREEN
610 N = R: N1 = N: Z = 0
620 FOR FP = 2 TO SQR(N)
    630 IF N / FP = INT(N / FP) THEN GOSUB 510: Z = 1: GOTO 620
650 NEXT: IF N <> 1 THEN PRINT N; "="; N1: GOTO 670
660 PRINT N; "="; N1
670 R = R + 1: IF R > EN THEN RETURN
680 GOTO 610
695 REM PRIME FINDER
700 N = R: N1 = N: IF N = 2 THEN GOTO 740
705 IF N = 1 THEN X = 1: NN = 1: GOTO 740
710 FOR FP = 2 TO SQR(N)
    720 IF N / FP = INT(N / FP) THEN X = 1: GOTO 750
730 NEXT
740 IF N <> 1 THEN GOSUB 1200: GOTO 750
750 R = R + 1: IF R > EN THEN RETURN
760 GOTO 700
765 REM END OF OPTION SELECT
770 PRINT: PRINT: INPUT "TYPE Q TO QUIT OR M TO RETURN TO THE MAIN MENU"; Y$
780 IF Y$ = "Q" OR Y$ = "q" THEN 1150
790 IF Y$ = "M" OR Y$ = "m" THEN 90
800 Y$ = "": PRINT: GOTO 770
805 REM FACTORS OF ONE NUMBER
810 CLS: PRINT: PRINT: PRINT "FIND THE FACTORS OF A NUMBER"
820 PRINT: PRINT: PRINT: INPUT "TYPE S FOR SCREEN OR P FOR PRINTER"; T$
830 IF T$ = "S" OR T$ = "s" THEN GOTO 860
840 IF T$ = "P" OR T$ = "p" THEN GOTO 910
850 GOTO 810
860 GOSUB 1120
870 CLS: PRINT: PRINT: PRINT: PRINT "FINDING THE FACTORS OF THE NUMBER"
880 PRINT NN
890 GOSUB 610
900 PRINT: PRINT "FINISHED": GOTO 770
910 GOSUB 1120
920 LPRINT "FACTORS OF THE NUMBER"; NN: LPRINT
925 PRINT "FACTORS OF THE NUMBER"; NN: PRINT
940 GOSUB 1300
950 LPRINT: LPRINT "FINISHED": PRINT: PRINT "FINISHED": GOTO 770
960 CLS: PRINT: PRINT: PRINT: PRINT "TEST A NUMBER FOR PRIME": X = 0
970 PRINT: PRINT: PRINT: INPUT "TYPE S FOR SCREEN OR P FOR PRINTER"; T$
980 IF T$ = "S" OR T$ = "s" THEN GOTO 1010
990 IF T$ = "P" OR T$ = "p" THEN GOTO 1060
1000 GOTO 960
1010 GOSUB 1120
1020 CLS: PRINT: PRINT: PRINT "TESTING THE NUMBER"; NN; "FOR PRIME": PRINT: PRINT
1030 GOSUB 700: IF X <> 0 THEN PRINT NN; "NOT PRIME": GOTO 1050
1040 PRINT "IS PRIME"
1050 PRINT: R = NN: GOSUB 610: GOTO 770
1060 GOSUB 1120
1070 LPRINT "TESTING NUMBER"; NN; "FOR PRIME": LPRINT
1075 PRINT "TESTING NUMBER"; NN; "FOR PRIME": PRINT
1090 GOSUB 700: IF X <> 0 THEN LPRINT NN; "NOT PRIME": IF X <> 0 THEN PRINT NN; "NOT PRIME": GOTO 1110
1100 LPRINT NN; "IS PRIME": PRINT NN; "IS PRIME"
1110 LPRINT: LPRINT: LPRINT "FINISHED": PRINT: PRINT: PRINT "FINISHED": GOTO 770
1115 REM SINGLE NUMBER ENTRY
1120 PRINT: PRINT: PRINT: INPUT "ENTER NUMBER (< 10,000,000)"; NN: N1 = NN
1130 IF NN < 1 OR INT(NN) <> NN THEN PRINT: PRINT S$: GOTO 1120
1140 R = NN: EN = NN: RETURN
1150 CLS: PRINT: PRINT: PRINT: PRINT "THANK YOU FOR USING FACTOR/PRIME FINDER":
1151 PRINT: PRINT " (C) JULY 1996, MARCH 2017 By William B. Brown":
1152 PRINT " WBBROWN11@GMAIL.COM":
1154 PRINT "        This program CANNOT be sold for any purpose without the EXPRESS";
1155 PRINT "                       written permission of the author.";
1156 PRINT "                              All rights reserved.": END
1200 IF SP = 0 THEN PRINT N; " ";: RETURN
1210 LPRINT N; " ";: PRINT N; " ";: RETURN
1295 REM FACTOR FINDER-PRINTER
1300 N = R: N1 = N: Z = 0
1320 FOR FP = 2 TO SQR(N)
    1330 IF N / FP = INT(N / FP) THEN GOSUB 1510: Z = 1: GOTO 1320
1350 NEXT: IF N <> 1 THEN LPRINT N; "="; N1: PRINT N; "="; N1: GOTO 1370
1360 LPRINT N; "="; N1: PRINT N; "="; N1
1370 R = R + 1: IF R > EN THEN RETURN
1380 GOTO 1300
1510 IF FP <> 2 THEN LPRINT FP; "*";: IF FP <> 2 THEN PRINT FP; "*";: N = N / FP: RETURN
1520 N = N / FP: IF N / FP = INT(N / FP) THEN LPRINT FP; "*";: IF N / FP = INT(N / FP) THEN PRINT FP; "*";: RETURN
1530 IF N <> FP AND N <> 1 THEN LPRINT FP; "*";: IF N <> FP AND N <> 1 THEN PRINT FP; "*";: RETURN
1540 LPRINT FP;: PRINT FP;: RETURN















 2 
 on: February 26, 2017, 04:02:43 am 
Started by bugmagnet - Last post by bugmagnet
The Linux release has CRLF line endings in the setup_lnx.sh file and, presumably in the rest as the install fails.

Just thought you should know.

bugmagnet

PS. I think I fixed the issue adequately with
$ find . -name "*.sh" -exec dos2unix {} \;

 3 
 on: February 26, 2017, 03:59:34 am 
Started by GarrisonRicketson - Last post by bugmagnet

Appears to be broken.

 4 
 on: May 30, 2016, 12:20:38 pm 
Started by rynsp8 - Last post by rynsp8
I'm having difficulty with a concept I'm trying to learn: character movement.  I've gotten my 'character' to display on screen; it's just a green dot with a white perimeter, and I can make it move using the arrow keys, but for some reason, it moves the 'character' but leaves a copy in the previous location.  The code is below:

-----------------------------------------------------------
_TITLE "character movement"
DIM SHARED scrn&, character&
DIM SHARED white&, green&, black&
scrn& = _NEWIMAGE(800, 600, 32)

SCREEN scrn&
CALL MakeColors

CALL MakeCharacter
character_x = 20
character_y = 20
gameover$ = "false"

DO

    CALL MakeCharacter
    _PUTIMAGE (character_x, character_y), character&, scrn&
    _DISPLAY

    k$ = INKEY$
    IF k$ <> "" THEN
        code = ASC(k$)
        IF code = 0 THEN
            code = ASC(k$, 2)
            IF code = 72 THEN 'move up
                character_y = character_y - 5
            ELSEIF code = 80 THEN 'move down
                character_y = character_y + 5
            ELSEIF code = 75 THEN 'move left
                character_x = character_x - 5
            ELSEIF code = 77 THEN 'move right
                character_x = character_x + 5
            END IF
        ELSE
            IF k$ = CHR$(27) THEN gameover$ = "true"
        END IF
    END IF
LOOP UNTIL gameover$ = "true"
SYSTEM

SUB MakeCharacter ()
character& = _NEWIMAGE(30, 30)
_DEST character&
CIRCLE (20, 17), 6, white&
PAINT (20, 17), green&, white&
END SUB

SUB MakeColors ()
white& = _RGB(255, 255, 255)
green& = _RGB(0, 255, 0)
black& = _RGB(0, 0, 0)
END SUB
---------------------------------------------------------------------

I've been going over it for a few days but I'm not making any headway.

 5 
 on: February 19, 2016, 01:44:32 am 
Started by rickinnip - Last post by rickinnip
I cannot get my programs or the sample programs to run.  I get the message I put in the subject line. 
Can anyone help?

email address = simonsen@charter.net

 6 
 on: February 14, 2016, 07:57:34 pm 
Started by kanga85 - Last post by kanga85
I have a QB64 file complied as an .EXE file.   It ends with the closing command 'System".   When I run this .EXE file and expect to close it I get the 'Unhandled Error #53.   Line 35.   File not found. Continue?'

The .EXE file is obviously looking for a file called 'System'.   How do I close a complied QB64 file elegantly?   'Exit' gives me an error within QB64.

Thanks for any help.

 7 
 on: December 07, 2015, 05:09:20 am 
Started by Raze Hallor - Last post by Raze Hallor
So this is my code:
INPUT "What is your name"; A$
PRINT "Hello "; A$
PRINT "Hello "; A$
PRINT "Hello "; A$
PRINT "Hello "; A$
PRINT "Hello "; A$
INPUT "Had Enough"; B$
IF input "yes" then print "One more thing"

It says Name already in use on line 8. Help?

 8 
 on: October 10, 2015, 12:25:53 pm 
Started by QB513 - Last post by yash
This will help you to understand QB64 Smiley
(? -Print , ' - comment )
? "my name"
locate 10 , 10

'this will print your name in column 10 and raw 10.
HAVE A GREAT JOB.
Thanx.
 Cool Cool Roll Eyes

 9 
 on: September 15, 2015, 09:42:07 am 
Started by TJE - Last post by TJE
Hello all.  I went through the FAQ and other posts and I do not see this posted anywhere.  I installed QB64 on my home computer.  The program appears to work, but when I RUN, all I get is a very quick black screen which disappears in a millisecond.  Any idea as to what is happening?  Thanks for any help at all. 

 10 
 on: September 15, 2015, 09:39:04 am 
Started by TJE - Last post by TJE
Howdy All,

Completely new to this.  Taking QB64 for my ET courses.  Electronics Technology, to be specific. 

Pages: [1] 2 3 ... 10
Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Buy traffic for your forum/website
traffic-masters
Powered by SMF | SMF © 2016, Simple Machines