MULTIPLICATON OF A FIELD IN A FILE WITH A CONSTANT

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

Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

moneo wrote:
PQBC wrote:I use this when I need to make a number have 4 decimal places.

Code: Select all

NumberTesting$ = STR$(Number)
IF NOT INSTR(".", NumberTesting$) THEN NumberTesting$ = NumberTesting + ".0000"
While LEN(NumberTesting)-INSTR(".", NumberTesting$) < 4
Let NumberTesting$ = NumberTesting$ + "0"
WEND
Other than the fact that you left the dollar sign off of NumberTesting$ twice, and that the code is a little verbose, it looks like it should get the job done.
*****
moneo wrote:Watch out, the timer resets at midnight.
*****
Do you just go around my posts looking for errors? My internet computer doesn't have QBASIC because it can't run it right. I am only running these through PQBC-BASIC (my head), which is not always correct :wink:

Anyway, I fixed the NumberTesting$ and put my $'s on correctly.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

PQBC wrote:.....
Do you just go around my posts looking for errors? My internet computer doesn't have QBASIC because it can't run it right. I am only running these through PQBC-BASIC (my head), which is not always correct :wink: .....
Please don't take it personal, PQBC. When a member posts some code, if I understand it, I always check it out for possible problems. Most of the time, I actually compile and test it. If I find any errors, I feel an obligation to point them out so that someone doesn't just insert the code into his program and have problems.

In your case, since you're posting code right off the top of your head, now that we know, we will take your code with "a grain of salt"; that is, we'll consider the idea or intent more than the actual code. Too bad you have to work in this fashion. When do you think you'll get QBasic working?
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

I was joking around...

Anyway, If I find a solution to my QB problem, I'll be sure to tell you.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

PQBC wrote:.....If I find a solution to my QB problem, I'll be sure to tell you.
Can you run DOS at all on your Internet machine?
If not, have you considered booting DOS either with a dual-boot option or from a diskette?

If you can get to DOS by either of the above methods, then you can compile, test, and run your programs with Quickbasic 4.5 directly in DOS.
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

moneo wrote:When a member posts some code, if I understand it, I always check it out for possible problems.
moneo wrote:5) The PRODUCT will contain as many decimal places as the numbers determine. If the IPNUM had 2 decimals, then 2 + 1 of the .9 can give you a maximum of 3 decimal places in the PRODUCT.

Code: Select all

DIM a AS DOUBLE
DIM b AS DOUBLE
DIM c AS DOUBLE
a = 1.1
b = 2.7
c = a / b
PRINT c
Maybe you missed it when I posted it a few posts ago..
I have left this dump.
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

Michael Calkins wrote:All caps does make text harder to read, but you would expect that MS-DOS programmers like us would be used to that. For example: file names in DOS are usually all caps, as are license agreements and some documentation for MS-DOS programs. All caps is no reason to flame, and absolutely not an indication of stupidity, anymore than all lowercase is.
Regards,
Michael
Long live MS-DOS! Long may it reign!! :-D
What about those of us who spent our last days of QB using Notepad? :lol: :lol: :lol:

Just messin (although I really did use Notepad for my last QB projects) but I see your point. :D
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

There is really no point.

Douth thou typeth like this my good sir knight?
(Add "proper" old english letters and phonetics as you please..)


Typing in all caps is a step back in "writing evolution" (call it whatever) where you move from the current, modern, highly expression rich form, to ancient, sterile writing.

There is a reason we use case, period, comma, exclamationmark, etc..

While I agree that you don't have to follow every single grammar rule 100% writing in all caps, makes you seem underly educated, and downright stupid.

Lately (read: the last 10 years) writing in all caps on the internet, or in emals, have been considered shouting.


I would slap anyone coming up to me shouting questions.
I slap anyone coming up to me shouting questions.


Also, just because you poor old people can't adapt, does not mean we have to adapt to you.


I demand you all learn swedish, I'm used to swedish, and as such, you must adapt and accept it.

Should we all be that silly? No.

Besides, if it was all lowrcase, I wouldnt care one bit about it. So, why not just change from upper->lower, is it that hard for you to adapt? Are you that snowed in on your old deprecated, outdated routines?


And yes, this post is pretty much a bashing of people defending themselves with: "But I'm used to it"


Don't get me wrong, I respect you for your knowledge moneo, but really.. Just because people do it, doesent mean it's right, or proper. Nor does it mean it's ok just because you're used to it.


Lisa, 11, is used to being raped by her father, as she's been since she was 7. Guess that's ok then?
I have left this dump.
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

あなたへのおはよう!
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

Z!re wrote:
moneo wrote:When a member posts some code, if I understand it, I always check it out for possible problems.
moneo wrote:5) The PRODUCT will contain as many decimal places as the numbers determine. If the IPNUM had 2 decimals, then 2 + 1 of the .9 can give you a maximum of 3 decimal places in the PRODUCT.

Code: Select all

DIM a AS DOUBLE
DIM b AS DOUBLE
DIM c AS DOUBLE
a = 1.1
b = 2.7
c = a / b
PRINT c
Maybe you missed it when I posted it a few posts ago..
No, I didn't miss the divide instead of the multiply, but I figured that the math operation didn't matter for what the issue was.

Plus, I usually don't touch your code with a ten foot pole, 'cause you'll bite my head off. :wink:
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Moneo: I was correcting you.. decimals are determined by the variable type, not the number of decimals used in the factors

Sodacan: Poop
I have left this dump.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

Z!re wrote:Moneo: I was correcting you.. decimals are determined by the variable type, not the number of decimals used in the factors.....
I can't figure out what you were correcting, but that's ok, you go ahead and correct whatever you want. :wink:
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

moneo wrote:f the IPNUM had 2 decimals, then 2 + 1 of the .9 can give you a maximum of 3 decimal places in the PRODUCT.
That's wrong.
I have left this dump.
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} »

Z!re... how old are you, and are you blonde?
Image
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

I'm 20, and yes.
I have left this dump.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

Z!re wrote:
moneo wrote:f the IPNUM had 2 decimals, then 2 + 1 of the .9 can give you a maximum of 3 decimal places in the PRODUCT.
That's wrong.
I'll admit that my sentence could have been written clearer, but what part do you consider wrong?

A product can have as many maximum decimals as the sum of the decimals in the multiplicand and the multiplier. Do you agree?
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

No, because:
1.1/2.9 Does not equal 2 decimals. Besides, if you go by the math rules, then you always use the number with the LEAST decimals as the highest accuracy, thus: 1.1/2.987+1.53 = 1.9

Not: 1.898262 (Which you would get by following your rule, of adding the decimals together)


Ofcourse, if you mean addition and subtraction.. but as you said: PRODUCT, which is only used when multiplying or dividing.. well..
I have left this dump.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

Sorry Z!re, but I have been referring to MULTIPLICATION all along because that was the operation in the original post of this thread. In your example, you introduced DIVISION.

BTW, the term PRODUCT is only used for the result of a multiplication. The result of a divide is called the QUOTIENT. Well, so much for the English lesson. :wink:
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

My bad, in swedish product refers to both multiplication and division..
I have left this dump.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

Perhaps in Swedish the word product has a more general meaning like "result". Could be that product is of more general usage in other languages too. I'll check in Spanish, since I know of no equivalent word for quotient.

I'll have to be careful in the future, when addressing an international audience, not to use the word product, and perhaps replacing it with "the result of the multiplication".

Thanks, Z!re, for making me aware of this.
*****
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

The word product, inswedish, has the same meaning as in english..

Product = The result of something, a process, math, etc..
"This product is good"


And don't sweet it, I just thought of it because someone asked me about it..
(The 1.1/2.9 that is, which we now know wasnt used or refered to)
I have left this dump.
Post Reply