Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Visual Basic: Maths?

    I wan to make a calculator. Can anyone else tell me some mathematical commands??

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    which commands to you know, i do VB at college, tis going quite slowly but i know the following:

    Code:
    Dim a as integer               'Declares variable a as integer (whole number)
    Dim b as integer               'Declares variable b as integer (whole number)
    There are different types of variables, long i think hold a number that can include decimals so

    Code:
    Dim a as long               'Declares variable a as long (number with decimals)
    Dim b as long               'Declares variable b as long (number with decimals)
    then you can do the following:
    (basically normal maths stuff)

    Code:
    a=25
    b=5
    print str(a) & "divided by" &str(b) &"equals "& str(25/5)
    str(variablename) makes the variable act like a string in the instance it is used.

    so some more maths
    Code:
    a=30
    b=6
    print a*b
    print a+b
    print a-b
    there are other operations you can do.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Dim a as long 'Declares variable a as long (number with decimals)
    A Long doesn't have any decimals. It just whole number with a bigger range than an Integer.

    shmoove


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •