Weekly Qbasic and Qb64 Lesson Topics
April 18, 2024, 08:58:59 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] 4 5 ... 10
 21 
 on: August 30, 2017, 10:22:34 am 
Started by QB513 - Last post by Dimster
I am new to this website, please consider this reply as me just exploring the site and trying out things to do. I'm sure QB513 has figured out this problem or abandoned coding altogether by now. If QB513 is familiar with Arrays and the Dim function, one way the problem could be solved is to dimension an array to hold each day's pay - so Dim Pay(30). You would then create a for/next loop . for P = 1 to 30. Within the loop you will need a line of code to do the math, ie take a the last day's pay and double it. Then store that value in Pay(P). (Note:Whatever variable you are using for the "last day's pay" should be made equal to "0" before the for/next loop. After the looping has ended you will need another for/next loop to calculate the total of all the values stored in Pay(30). As for the Printed Report, Yash has given a very good hint. The "?" is a shorter way to code the command word "Print" and the use of "Locate" for your columns and rows is the way to go. You simple need to print what you have stored in your Arrays and the Variable you have storing the total amount paid.

Seems there is quite a bid of room for these replies. The Preview shows only one line at a time but that's cool, it does pick up the Bolding and Italic and color.

 22 
 on: August 29, 2017, 03:08:33 pm 
Started by Dimster - Last post by Dimster
Trying to code a drop down menu in QB64. I am new to QB64 and understand the concept of drawing a line/box, erase and redraw I'm lost on coordinating the color fill of the box with the menu items that i want to appear in the various drop down boxes. Are there some sample codes in some of the QB64 commands that i could read up on and play with or some site/book that may give me some ideas on Drop Down Menu's. Thanks

 23 
 on: July 31, 2017, 12:03:04 pm 
Started by Mal-2 - Last post by Mal-2
I am having a problem with mouse input. Clicks go through and get processed correctly, but if the mouse is moved even one pixel while the button is down, then it registers as a second click. If the motion goes even further than one pixel, it fires off a new click for every pixel moved! How can I make QB64 ignore mouse drags and treat them as merely a click at the initial position? [Answer: run a loop that polls mouse info until the button is released. Place it after whatever loop was waiting for the original click. Very hacky, but apparently necessary.]

Also, is there a way to make sound files play in stereo? They get downmixed to mono now. [Confirmed to be a qb64 bug introduced when the underlying codebase was moved from SDL to GL. Version 0.954 does not have the problem – but sticking with an old, unsupported build is not a viable option.]

 24 
 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















 25 
 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 {} \;

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

Appears to be broken.

 27 
 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.

 28 
 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

 29 
 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.

 30 
 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?

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


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy