Search found 98 matches

by Zim
Wed Jan 04, 2006 12:29 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: new using qbasic
Replies: 6
Views: 8107

Duh...

Sorry, I meant under the topic "QB Coding and Printer questions".

(...fairly new member gets lost in the forum...)
by Zim
Wed Jan 04, 2006 12:24 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: printing
Replies: 20
Views: 30846

LPRINT

Doesn't the LPRINT command send commands to the printer? Lprint DOES send data to the printer, but only text such as the contents of string or numeric constants or expressions, like LPRINT "Hello" LPRINT num+6 He's trying to print graphics, which in the case of DOS is easy by pressing the...
by Zim
Wed Jan 04, 2006 12:18 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: opening WORD
Replies: 6
Views: 6487

Returning to Basic

You need an exit from the shell. If it's not returning to QB automatically, you may need to run a batch file instead of WORD directly, then put the command "exit" at the end of the batch file. (...but I didn't actually try this).
by Zim
Mon Jan 02, 2006 12:24 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: new using qbasic
Replies: 6
Views: 8107

Printing to Network Printer

See my response under "Newbie Question: Line Breaks"
by Zim
Mon Jan 02, 2006 12:20 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: QB Coding and Printer questions
Replies: 3
Views: 6045

Printing from DOS to a Network Printer

Printing from DOS to a network printer is easy with the Windows "Net use" command. Before printing (via a batch file or something) issue a "net use" command like: Net Use lpt1: \\servername\printername I've noticed on my network, it works best to delete it first, even if it doesn...
by Zim
Mon Jan 02, 2006 12:10 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Newbie Question: Line Breaks?
Replies: 4
Views: 18434

Line Breaks

If you're printing to a file, the same concept works:

Code: Select all

Print #1,"A"
Print #1,
Print #1,"B"
...etc...
Just don't forget the comma on the empty Print # statement.
by Zim
Mon Dec 19, 2005 12:50 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Seeding Random Numbers
Replies: 4
Views: 7238

How rnd really works

Thanks guys! That's exactly what I was looking for. I have suspected for a long time that my (qb 3.0) rnd state is only 3 bytes long. This confirms it. I'll take the code and try it in both qb 3 and qb 4. (BTW, the rnd output in GW-BASIC is different. I suspect it has slightly different parameters.)
by Zim
Mon Dec 19, 2005 12:18 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Totlas and Counters help
Replies: 13
Views: 12731

summing and counting

Ok, here's a couple of lines of code for you: To count something you must start with a counter set to zero! sumpos=0 To test if something is positive check if it's greater than zero: if num>0 then..... To count, add "1" to the counter (conditionally, of course): if num>0 then sumpos=sumpos...
by Zim
Fri Dec 16, 2005 12:27 pm
Forum: General Discussion
Topic: Your favorite search engine...
Replies: 30
Views: 60726

AltaVista?

I know this is a dead topic, but...

AltaVista's "Link:" search option will return results when Google's "Link:" option will not.
by Zim
Fri Dec 16, 2005 12:17 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Seeding Random Numbers
Replies: 4
Views: 7238

Seeding Random Numbers

Ok, my turn... There are a couple of topics here dealing with random number/letter generation. My question deals with starting, or seeding Basic's random number genereator (rng). Generally that is done with the Randomize statement using "timer" as the seed value: RANDOMIZE timer But I have...
by Zim
Fri Dec 16, 2005 12:02 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Secure Logon prog.(w/ encryption)
Replies: 19
Views: 34339

What's the Question/Answer

How about asking questions whose answers vary with time, then have the program check the time, compute the correct answer and compare that with the answer supplied by the user.... just a thought...
by Zim
Thu Dec 15, 2005 12:46 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Pascal's Triangle Help
Replies: 2
Views: 5339

Pascal's Triangle

The fun in programming is learning to do it and seeing positive results. Start with an array and a loop. Make the array as big as you need it to be for the final row of the triangle. Start with a two element array consisting of 1, 1. Within the loop reproduce the first array element, then compute (a...
by Zim
Mon Dec 12, 2005 11:57 am
Forum: QBASIC and QB64 Questions & Answers
Topic: Questions from Vic The Dice Man
Replies: 5
Views: 6913

Testing for divisibility by two

considering the fact that it was school, I simply dared to assume that part of the exercise was to be able to determine if a number was even Mystik, also a good point. Oh, btw, when dividing by two you could also use the "integer division" operator, \, the backslash. For example: if n\2 =...
by Zim
Mon Dec 12, 2005 11:51 am
Forum: QBASIC and QB64 Questions & Answers
Topic: Random Letters
Replies: 5
Views: 14336

Random names

I wrote a program in QuickBasic to generate a list of random names and associated random email addresses (as spam bait). You can find the output here: http://www.chibardun.net/~zim/friends.htm I downloaded a list of the most popular boys/girls/sur- names from the government's census bureau web site ...
by Zim
Fri Dec 09, 2005 12:30 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: odd or even
Replies: 20
Views: 31183

Divisibility by 4 ie. Leap Year

Here's a trick I use to check for divisibility by 4, for Leap Years and such:

Code: Select all

for i = 2000 to 2017
  print i;
  if i and not -4 then print "Not" else print "Is"
next i
The "-4" is for divisibility by 4. The same concept will work for any power of two.
by Zim
Fri Dec 09, 2005 12:17 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Questions from Vic The Dice Man
Replies: 5
Views: 6913

Counting Even Numbers

How about:

Code: Select all

sum=0
for i=2 to 30 step 2
     sum=sum+i
next i
print sum
We often forget the "skip" keyword on the for statement. Its use eliminates the need for a test inside the loop.

--Zim
by Zim
Wed Dec 07, 2005 12:23 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Compatibility
Replies: 15
Views: 22032

Dos (text mode) compatibility

I've compiled and run programs using QuickBASIC v 3.0 on 8086, 286, 386, 486, Pentium I, II, and III computers running DOS 2.1, 3.x, 5, 6.0, and 6.2 plus Windows 3.1, 95, 98, NT 3.51, NT4.0, Windows 2000, and Windows XP with no compatibility issues found anywhere. But then, I don't do very complicat...
by Zim
Mon Dec 05, 2005 4:57 pm
Forum: QBASIC and QB64 Questions & Answers
Topic: Random Numbers
Replies: 20
Views: 47242

Random Numbers (are we done yet?)

Ok, I'm back, and not a guest anymore. ;)