Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# Numbers game

C# Numbers game

Scheduled Pinned Locked Moved C#
csharpdelphicomgame-devhelp
27 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pavlex4

    Error is: Attempted to divide by zero.

    OriginalGriffO Online
    OriginalGriffO Online
    OriginalGriff
    wrote on last edited by
    #15

    Well, the error message pretty much explains itself. Mathematics does not allow you to divide by zero, so you should probably make sure your application doesn't try to do that, wouldn't you say? The fun bit is finding out why your application is trying at all. And - again - that's where you and Mr Debugger get to be good friends, because he's the one that tells you how the divisor came to be zero: which is pretty much essential to preventing it in future. Seriously, get used to the debugger - it's a powerful, flexible tool that most developers spend a considerable amount of time with. It's a lot more fun - and a lot quicker - to find the information than it is to ask here. Especially as most of the time we have to say "use the debugger to get information" anyway! :laugh:

    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    P 1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      Well, the error message pretty much explains itself. Mathematics does not allow you to divide by zero, so you should probably make sure your application doesn't try to do that, wouldn't you say? The fun bit is finding out why your application is trying at all. And - again - that's where you and Mr Debugger get to be good friends, because he's the one that tells you how the divisor came to be zero: which is pretty much essential to preventing it in future. Seriously, get used to the debugger - it's a powerful, flexible tool that most developers spend a considerable amount of time with. It's a lot more fun - and a lot quicker - to find the information than it is to ask here. Especially as most of the time we have to say "use the debugger to get information" anyway! :laugh:

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      P Offline
      P Offline
      Pavlex4
      wrote on last edited by
      #16

      When I changed all loops to start from 0 to n-1,those that start with other number than 0 I set to start from value reduced by 1 to n-1 I still get error: Index was outside the bounds of the array

      OriginalGriffO 1 Reply Last reply
      0
      • P Pavlex4

        When I changed all loops to start from 0 to n-1,those that start with other number than 0 I set to start from value reduced by 1 to n-1 I still get error: Index was outside the bounds of the array

        OriginalGriffO Online
        OriginalGriffO Online
        OriginalGriff
        wrote on last edited by
        #17

        And? What did the debugger show you?

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        P 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          And? What did the debugger show you?

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

          P Offline
          P Offline
          Pavlex4
          wrote on last edited by
          #18

          I fixed that error but when I start program and input target value and values I get wrong expression. When I type 100 for target number and numbers 5,8,9,4,20,50 for making expression I get: 5150-(' + w + ')+5355+5150 Instead of: (6-1)*4*5

          OriginalGriffO D 2 Replies Last reply
          0
          • P Pavlex4

            I fixed that error but when I start program and input target value and values I get wrong expression. When I type 100 for target number and numbers 5,8,9,4,20,50 for making expression I get: 5150-(' + w + ')+5355+5150 Instead of: (6-1)*4*5

            OriginalGriffO Online
            OriginalGriffO Online
            OriginalGriff
            wrote on last edited by
            #19

            At the risk of repeating myself:

            Quote:

            And? What did the debugger show you?

            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              :-D A quick visit with Mr Debug would have shown the OP as well! :laugh:

              Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #20

              OriginalGriff wrote:

              visit with Mr Debug would have shown the OP

              Why bother when you can be a help vampire?

              Speed of sound - 1100 ft/sec Speed of light - 186,000 mi/sec Speed of stupid - instantaneous.

              OriginalGriffO 1 Reply Last reply
              0
              • P Pavlex4

                I fixed that error but when I start program and input target value and values I get wrong expression. When I type 100 for target number and numbers 5,8,9,4,20,50 for making expression I get: 5150-(' + w + ')+5355+5150 Instead of: (6-1)*4*5

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #21

                OK. Sit down and listen up. Your'e trying to get everyone here to debug your code for you. That's not going to happen. The debugger is there to debug YOU, to give you a tool to understands how your code works, what it's really doing, to increase your understanding. USE IT. The problem with the code you have is that you didn't write it and have no idea how it's supposed to work. This is where the debugger is an indispensable tool, to better your understanding of how the code works. We can't do that for you.

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                OriginalGriffO 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  OK. Sit down and listen up. Your'e trying to get everyone here to debug your code for you. That's not going to happen. The debugger is there to debug YOU, to give you a tool to understands how your code works, what it's really doing, to increase your understanding. USE IT. The problem with the code you have is that you didn't write it and have no idea how it's supposed to work. This is where the debugger is an indispensable tool, to better your understanding of how the code works. We can't do that for you.

                  A guide to posting questions on CodeProject

                  Click this: Asking questions is a skill. Seriously, do it.
                  Dave Kreskowiak

                  OriginalGriffO Online
                  OriginalGriffO Online
                  OriginalGriff
                  wrote on last edited by
                  #22

                  The amount of time and effort he's putting into avoiding work ... :sigh:

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  1 Reply Last reply
                  0
                  • L Lost User

                    OriginalGriff wrote:

                    visit with Mr Debug would have shown the OP

                    Why bother when you can be a help vampire?

                    Speed of sound - 1100 ft/sec Speed of light - 186,000 mi/sec Speed of stupid - instantaneous.

                    OriginalGriffO Online
                    OriginalGriffO Online
                    OriginalGriff
                    wrote on last edited by
                    #23

                    Maybe we need a special badge for 'em :laugh:

                    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    L Richard DeemingR 2 Replies Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      Maybe we need a special badge for 'em :laugh:

                      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #24

                      OriginalGriff wrote:

                      special badge

                      Good idea....Bob with vampire fangs.

                      Speed of sound - 1100 ft/sec Speed of light - 186,000 mi/sec Speed of stupid - instantaneous.

                      1 Reply Last reply
                      0
                      • P Pavlex4

                        I have converted game from pascal to C# but when I start program and type in target value and values for finding that value program gives me error:[^] Pascal source: [Pascal] Moj Broj - Pastebin.com[^] C# Source: [C#] Moj Broj C# - Pastebin.com[^]

                        P Offline
                        P Offline
                        Patrice T
                        wrote on last edited by
                        #25

                        if (!uzet[l]) s--; -----Index was outside the bounds of the array--------

                        This error message tells you that your code try to access an element rgat do not exist in the array uzet because uzet us too small. With the debugger, check the size of uzet.

                        Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein

                        M 1 Reply Last reply
                        0
                        • P Patrice T

                          if (!uzet[l]) s--; -----Index was outside the bounds of the array--------

                          This error message tells you that your code try to access an element rgat do not exist in the array uzet because uzet us too small. With the debugger, check the size of uzet.

                          Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein

                          M Offline
                          M Offline
                          Mycroft Holmes
                          wrote on last edited by
                          #26

                          ppolymorphe wrote:

                          rgat

                          Missed by that much :laugh:

                          Never underestimate the power of human stupidity RAH

                          1 Reply Last reply
                          0
                          • OriginalGriffO OriginalGriff

                            Maybe we need a special badge for 'em :laugh:

                            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                            Richard DeemingR Offline
                            Richard DeemingR Offline
                            Richard Deeming
                            wrote on last edited by
                            #27

                            Couldn't find a vampire; will this do? 🦇 🦇 Bat Emoji[^]


                            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups