1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Code for calculating miner costs - vb.net

Discussion in 'Code' started by Cilantro33, Mar 21, 2018.

  1. Cilantro33

    Cilantro33 Well-Known Member
    MVP

    Joined:
    Nov 3, 2017
    Messages:
    130
    Likes Received:
    19
    As this title says I'm gonna be showing off some of the code I use for a miner cost calculator I've made, I thought instead of giving everyone the program (which I might do in the future) that I would let some people think about how they could use it. This is in visual basic code or vb.net but it is easily translatable to other languages if you know what you are doing.

    Also I used vb.net cause it is very easy.

    Code:
    Dim dminer1 As New Integer = Integer.parseInt(text)
    Dim dminer2 As New Integer = Integer.parseInt(text)
    dminer2 -= 1
    For level As Integer = dminer1 To dminer2
             ecoins += (500000 + (500000 * level))
    Next
    I would love to see some programs pop up with this, so have some fun! Just saying, for integers make sure it isn't over a certain amount or else it'll crash, I could use doubles but it might come out as this: 1.0E8 or something like that it just isn't worth the work for people to try to figure that out.
     
  2. Asmcx15

    Asmcx15 Member
    Supreme

    Joined:
    Nov 13, 2017
    Messages:
    14
    Likes Received:
    0
    use ulong for larger integers
     
  3. Cilantro33

    Cilantro33 Well-Known Member
    MVP

    Joined:
    Nov 3, 2017
    Messages:
    130
    Likes Received:
    19
    I found doubles also work, just a stupid mistake on my part, but to my knowledge you should still be able to calculate any usable miner cost without getting an arithmetic error.
     
  4. RedDragon_CC

    RedDragon_CC Active Member

    Joined:
    Jul 29, 2018
    Messages:
    39
    Likes Received:
    1
    Nice little code you have going on there... I'll see what I can do with it :D
     
  5. Cilantro33

    Cilantro33 Well-Known Member
    MVP

    Joined:
    Nov 3, 2017
    Messages:
    130
    Likes Received:
    19
    Hint use Double instead of Integer
     

Share This Page