exceeding 9,999,999

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Post Reply
relic
Newbie
Posts: 4
Joined: Tue Feb 08, 2005 6:13 pm

exceeding 9,999,999

Post by relic »

I was wondering if there is a piece of code you can use in qb45 that will make it possible to print a number beyond 9,999,999? I noticed that while you can print 10000000, whenever you have a variable that prints the same number, it comes up as: 1E+07
thanks for any help.
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

:) like this:

Code: Select all

num# = 10000000
PRINT num#
put the # on you variable to keep it from doing scientific notations.. :wink:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
Xerol
Veteran
Posts: 81
Joined: Tue Jan 04, 2005 6:27 pm
Location: Timonium, MD
Contact:

Post by Xerol »

More specifically, # defines a number as double-precision. Eventually you will hit a point where those go into xE+yy form as well, except it'll say xD+yyy instead.

You could also have done the following:

DIM num AS DOUBLE

or:

DEFDBL N

The first one declares num as a variable of type double. The second one automatically makes any variables starting with the letter N double precision.
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.

Xerol's Music - Updated Regularly!
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Shouldn't you make it a Long type (num&)?
"But...It was so beutifully done"
relic
Newbie
Posts: 4
Joined: Tue Feb 08, 2005 6:13 pm

re: exeeding 9,999,999

Post by relic »

It works! (of course). :D
you guys rock!
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

In the library section, there is a lib called "BigINT" that can handle huge #s, not just ints though. :lol:
Image
Post Reply