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 variables and in...
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, ...
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...
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$(a$, 1...
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$ needs...
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, but...
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 screen.
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, . . . . ---------...
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 and...
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 below...
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$ + "\" +...
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. O...