|
-
Nov 19th, 2000, 07:41 PM
#1
Thread Starter
Fanatic Member
How do u add 2 numbers together and how do u subtract two numbers!
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Nov 19th, 2000, 07:44 PM
#2
Add: Val(number1) + Val(number2)
Subtract: Val(number1) - Val(number2)
-
Nov 19th, 2000, 07:45 PM
#3
1) You don't need to use Val, unless you are converting from a String.
2) You need the value to be assigned to another variable.
Code:
'Add
Num3 = Num1 + Num2
'Subtract
Num3 = Num1 - Num2
-
Nov 19th, 2000, 07:55 PM
#4
I don't think it'd matter though. Only reason I put Val was because number + number or number - number doesn't always give the right result. Ever see that problem before, Megatron?
And I do know that it has to be assigned to something else. Not always a variable.
msgbox num1 + num2
But he just wanted to be shown how to add and subtract.
VIP3R: Amnesia?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|