Search found 23 matches

by Artie
Tue Mar 23, 2004 4:01 pm
Forum: QBasic / QuickBasic related
Topic: writing quotes to files
Replies: 7
Views: 2513

Re: writing quotes to files

CHR$(32) = space
CHR$(34) = "

:)
by Artie
Tue Mar 16, 2004 3:45 pm
Forum: QBasic / QuickBasic related
Topic: trouble with sort
Replies: 7
Views: 2172

Re: trouble with sort

This is a good time to practice using SubRoutines also.
They make program flow a little easier to follow:

Setup:
 OPTION BASE 1
 CLS
 v = 5
 DIM a(v, 2), b(v)
 GOSUB Load
 GOSUB Compare
 GOSUB Sort
 GOSUB PrintList
 END

Load:
 ' Load ...
by Artie
Tue Mar 16, 2004 3:32 pm
Forum: QBasic / QuickBasic related
Topic: trouble with sort
Replies: 7
Views: 2172

Re: trouble with sort

Ok, this code works:
Also, note that in this example, I'm counting the number of variables greater than , rather than less than as in the above example.

Setup:
OPTION BASE 1
CLS
v = 5
DIM a(v, 2), b(v)
' Load variables and initialize position variable to zero.
FOR q = 1 TO v
READ t
a(q, 1 ...
by Artie
Tue Mar 16, 2004 2:30 pm
Forum: QBasic / QuickBasic related
Topic: trouble with sort
Replies: 7
Views: 2172

Re: trouble with sort

Hi Jonathon; Here's an example of a technique that I use:

First, I use the "Option Base 1" command because I like my arrays to start with 1 instead of zero. Then, create a 2-dimension variable. The first element stores the actual value, the second element stores its position in the line.
Next, I'm ...
by Artie
Tue Mar 16, 2004 2:15 pm
Forum: QBasic / QuickBasic related
Topic: input without input
Replies: 15
Views: 8508

Re: input without input

Hi Yac;  here's what I do:

The function keys and arrow keys are two-byte codes, so test for all possible one-byte codes first.

KeyCatcher:
a$ = INKEY$
IF a$ = "" THEN GOTO KeyCatcher
IF a$ = CHR$(27) THEN END
'  Put all your other key press tests here.
IF LEN(a$) = 2 THEN a$ = RIGHT ...
by Artie
Mon Mar 15, 2004 3:55 pm
Forum: QBasic / QuickBasic related
Topic: OPEN command help
Replies: 19
Views: 8091

Re: OPEN command help

hi. ok i used this:

INPUT "What file do you want to copy"; filepath$
dir$ = filepath$ + " C:\DOS"
SHELL dir$


Hi Brent; you're doing this backwards. Lets say you enter "taco" for your filepath$.

Your dir$ will become taco C:\DOS , which isn't any kind of DOS command, (or any other.)

Your dir ...
by Artie
Tue Mar 09, 2004 2:41 pm
Forum: QBasic / QuickBasic related
Topic: input without input
Replies: 15
Views: 8508

Re: input without input

You can do this, but it starts to get complicated, by reading the keyboard buffer, or something like that.

Check out this thread over at QbasicNews.com:

http://forum.qbasicnews.com/viewtopic.php?t=5421

Be sure to read the "links" in the "links. It'll take some reading and work to figure it out ...
by Artie
Tue Mar 09, 2004 3:13 am
Forum: QBasic / QuickBasic related
Topic: print function
Replies: 7
Views: 2198

Re: print function

You're welcome.    ;D

I'm in the intermediate stage.  I know more than beginners, but not as much as the experts.

When I get stuck, I go over to: QuickBasicNews.Com

Another great QB forum.   ;)
by Artie
Mon Mar 08, 2004 9:23 pm
Forum: QBasic / QuickBasic related
Topic: print function
Replies: 7
Views: 2198

Re: print function

Or better yet, try this code:

---------------------------------------------
CLS
a$=""
FOR x = 1 to 26
IF x MOD 2 > 0 THEN a = x + 64 else a = x + 96
a$ = a$ + CHR$(a)
NEXT x
LOCATE 10, 10: PRINT a$
END
-----------------------------------------------

The two 10's can be anywhere you want on the ...
by Artie
Mon Mar 08, 2004 8:32 pm
Forum: QBasic / QuickBasic related
Topic: print function
Replies: 7
Views: 2198

Re: print function

You can put anything you want into a DATA statement:

DATA A,b,C,d,E,my poo don't stink,f,G,h, . . .

Just make sure the "FOR x = . . ." has the correct number of elements.

FOR x = 1 to 26   if you're going to use one letter of the alphabet each.
by Artie
Mon Mar 08, 2004 2:14 pm
Forum: QBasic / QuickBasic related
Topic: print function
Replies: 7
Views: 2198

Re: print function

There's a couple different ways you could do this. One way would be to build a string before you print;

-----------------------------------------------------------
FOR x = 1 to 52
READ a$
alphabet$ = alphabet$ + a$
NEXT x
PRINT alphabet$
. . .
' your code
. . .
DATA A,a,B,b,C,c ...
by Artie
Sun Mar 07, 2004 5:26 pm
Forum: QBasic / QuickBasic related
Topic: OPEN command help
Replies: 19
Views: 8091

Re: OPEN command help

You're making me hungry Brent.   ;D

Its good to see young folk getting in to programming.  A couple of my grandkids are almost your age.

Your first example should have worked.  Double check your spelling and puntuation, and try it again.  I loaded the code just as you have it ...
by Artie
Sat Mar 06, 2004 10:52 pm
Forum: QBasic / QuickBasic related
Topic: OPEN command help
Replies: 19
Views: 8091

Re: OPEN command help

Anytime you want to use simple DOS commands, its easier to just SHELL out to DOS.

MKDIR "C:\QBASIC"
SHELL "COPY D:\Program1.exe c:\Qbasic"

When you use SHELL, you just put between quotes, whatever you'ld type at the DOS command line.

BTW - When you make a post here, just put a check in the box ...
by Artie
Fri Mar 05, 2004 3:26 pm
Forum: QBasic / QuickBasic related
Topic: OPEN command help
Replies: 19
Views: 8091

Re: OPEN command help

Hi Brentis; if you mean a directory, as in a folder, you can do that a couple different ways also:

Lets say you want to make a folder called "programs" within the "C:\temp" folder.

MKDIR "C:\TEMP\PROGRAMS"

or

CHDIR "C:\TEMP"
MKDIR "PROGRAMS"

or

dir$ = "PROGRAMS"
path$ = "C:\TEMP"
MKDIR path ...
by Artie
Wed Mar 03, 2004 6:43 pm
Forum: Other programming languages
Topic: Cool websites
Replies: 3
Views: 2533

Re: Cool websites

Hi Brentis;  nice website, lots of good info and stuff.

Just one little criticism - you're going to just annoy people with that cursor change. For someone with old eyes, like me, it makes it real hard to see. (Gray cross on a gray background.)  It serves no purpose and its just annoying ...