Hello!
I have the following code line
PRINT "POINT1",LOI1,LAT1,DIST1
and the 4 variables are decimals with a lot of figures behind the comma.
Would like to limit them all to 6 decimal and thought to use PRINT USING "**.******" as follows
PRINT "POINT1",USING "**.*****";LOI1,LAT1,DIST1
as global instruction. It doesn't work. What should I write?
Thanks in advance
REDUCING DECIMALS
REDUCING DECIMAL
Rectification: OnLY THE 3 Last ariables are decimal numbers
This works but I think there is a better way.
Code: Select all
test = 10.034983409834324
print test
print mid$(ltrim$(str$(test)),1,9)
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Redefine the number as a SINGLE type variable. But QB automatically makes undefined numerical values single. I don't see a Double (#) suffix!
Test2! = test
PRINT USING is one command. The text template follows the command!
Yes, you can include text in the template and the template can be a string variable set up for print using format before it is used.
Test2! = test
PRINT USING is one command. The text template follows the command!
Code: Select all
PRINT USING "POINT1 ##.######, ##.######, ##.######"; LOI1; LAT1; DIST1
Code: Select all
TMP$ = "POINT1 ##.######, ##.######, ##.######"
PRINT USING TMP$; LOI1; LAT1; DIST1
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Try this
PRINT #1, USING TMP$; variable; list
Ted
PRINT #1, USING TMP$; variable; list
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0