new using qbasic

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
moro145
Newbie
Posts: 2
Joined: Sun Dec 25, 2005 8:02 am
Location: Egypt

new using qbasic

Post by moro145 »

hii every body i'm working in updating project was developed in qbasic scince 1988 ,i face many problems understanding the code statments such as:

dh=cid-rod : dh2=cid*cid-rod*rod

y(1)=pvd:y(2)=od
IF ABS(y(1)-pvd)>10 GOTO 100

other mater is how to make the program prints the output to a usb printer attached in a network or directly to my computer ?
and how to make the output saved to excell sheet ,if possible?

thanks alot for your worthly help
hesham hafez
Antoni
Veteran
Posts: 132
Joined: Wed Jun 15, 2005 3:01 pm
Contact:

Re: new using qbasic

Post by Antoni »

moro145 wrote: dh=cid-rod : dh2=cid*cid-rod*rod
Just two assignment statements that could be in separate lines. In QB you can put several statements in the same line by separing them bycolons (:)
moro145 wrote: y(1)=pvd:y(2)=od
Two assignments to the co,ponents 1 and 2 of the array y. There must be a DIM y(size) as type at the start of the program to declara the array
moro145 wrote:
IF ABS(y(1)-pvd)>10 GOTO 100
ABS is th absolute value of the expression if it's bigger than 10 the program jumps to a line labeled with a 100
moro145 wrote:
other mater is how to make the program prints the output to a usb printer attached in a network or directly to my computer ?
You must make the printer available to DOS in the Windows printer settings (It was possible in W98 and W2000, don't know in XP). You assign the printer to a false LPT1 port. Then you can use QBasic's LPRINT.
If this does not work you can print to a file then print with Notepad (It will garble the line drawing characters)

Code: Select all

shell "notepad /p  yourprintfile
moro145 wrote:
and how to make the output saved to excell sheet ,if possible?
To export to Excel write to file using WRITE #. The resulting file is a csv file, easily imported in Excel

BTW: Moro145 sounds strange to spanish ears, as moro is here a derogative. But well, if you like it...:D
Guest

Re: new using qbasic

Post by Guest »

Antoni wrote:......
...... you can print to a file then print with Notepad (It will garble the line drawing characters)
Just a note regarding line drawing characters.
In WORD 2003 of Windws XP, you can see line drawing characters by doing the following:
1) Print to a file with a different file extension, like .FIL
2) Get into WORD.
3) Word presents a small window called "File Conversion". In this window, select "OEM United States" from the menu.
4) Word will now show your text with the proper line drawing characters.
5) You can now print this Word file.
*****
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

The above post was mine (Moneo).

I just remembered that the above also worked for me with Word under Windows 2000.
*****
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Printing to Network Printer

Post by Zim »

See my response under "Newbie Question: Line Breaks"
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: Printing to Network Printer

Post by moneo »

zim wrote:See my response under "Newbie Question: Line Breaks"
Sorry, but that response has nothing to do with this thread.
*****Moneo*****
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Duh...

Post by Zim »

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

(...fairly new member gets lost in the forum...)
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
Post Reply