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 / C++ / MFC
  4. what's function?

what's function?

Scheduled Pinned Locked Moved C / C++ / MFC
question
13 Posts 5 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.
  • M Offline
    M Offline
    Max
    wrote on last edited by
    #1

    Hi. Anybody know. what's function use for convert number between binary and decimal.

    L M 2 Replies Last reply
    0
    • M Max

      Hi. Anybody know. what's function use for convert number between binary and decimal.

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

      A number is a number whether binary or decimal. You have to define what you are trying to do before anyone will be able to help.

      Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy

      L 1 Reply Last reply
      0
      • L Lost User

        A number is a number whether binary or decimal. You have to define what you are trying to do before anyone will be able to help.

        Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        Wes Aday wrote:

        A number is a number whether binary or decimal.

        what about octal? :-D

        M L 2 Replies Last reply
        0
        • M Max

          Hi. Anybody know. what's function use for convert number between binary and decimal.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?

          "Go that way, really fast. If something gets in your way, turn."

          M L A 4 Replies Last reply
          0
          • L led mike

            Wes Aday wrote:

            A number is a number whether binary or decimal.

            what about octal? :-D

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            octal is so 1980s. I prefer base 7. :)

            "Go that way, really fast. If something gets in your way, turn."

            1 Reply Last reply
            0
            • L led mike

              Wes Aday wrote:

              A number is a number whether binary or decimal.

              what about octal? :-D

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

              led mike wrote:

              what about octal

              Well I can only count zero and not zero.... so octal is out of my league.... :-)

              Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy

              1 Reply Last reply
              0
              • M Mark Salsbery

                What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?

                "Go that way, really fast. If something gets in your way, turn."

                M Offline
                M Offline
                Max
                wrote on last edited by
                #7

                For Example (binary) (decimal) 00 0 01 1 10 2 11 3 What's function support this issue?

                1 Reply Last reply
                0
                • M Mark Salsbery

                  What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?

                  "Go that way, really fast. If something gets in your way, turn."

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  Ok... watching this could prove entertaining :-D

                  1 Reply Last reply
                  0
                  • M Mark Salsbery

                    What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?

                    "Go that way, really fast. If something gets in your way, turn."

                    A Offline
                    A Offline
                    Adno
                    wrote on last edited by
                    #9

                    #include #include #include using namespace std; int main(void){ string bi = "1010"; //binary int result= 0; for (int i = 0; i< bi.size(); i++){ if (bi[i] == '1'){ result += pow((double)2,(double)bi.size()-i)/2; } } cout << result << endl; return 0; } that should work

                    L 1 Reply Last reply
                    0
                    • A Adno

                      #include #include #include using namespace std; int main(void){ string bi = "1010"; //binary int result= 0; for (int i = 0; i< bi.size(); i++){ if (bi[i] == '1'){ result += pow((double)2,(double)bi.size()-i)/2; } } cout << result << endl; return 0; } that should work

                      L Offline
                      L Offline
                      led mike
                      wrote on last edited by
                      #10

                      string sbin("1011");     char* ptr;     long num = strtol( sbin.c_str(), &ptr, 2);     cout << num << endl;

                      A 1 Reply Last reply
                      0
                      • M Mark Salsbery

                        What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?

                        "Go that way, really fast. If something gets in your way, turn."

                        L Offline
                        L Offline
                        led mike
                        wrote on last edited by
                        #11

                        I see we are having another Fish Fillet special [below] :sigh: :laugh::laugh: I must horizontally challenged ... below above

                        Last modified: 1hr 25mins after originally posted --

                        M 1 Reply Last reply
                        0
                        • L led mike

                          string sbin("1011");     char* ptr;     long num = strtol( sbin.c_str(), &ptr, 2);     cout << num << endl;

                          A Offline
                          A Offline
                          Adno
                          wrote on last edited by
                          #12

                          oh cool function :omg:

                          1 Reply Last reply
                          0
                          • L led mike

                            I see we are having another Fish Fillet special [below] :sigh: :laugh::laugh: I must horizontally challenged ... below above

                            Last modified: 1hr 25mins after originally posted --

                            M Offline
                            M Offline
                            Mark Salsbery
                            wrote on last edited by
                            #13

                            :laugh: That's two mornings in a row I smelled McD's first thing :)

                            "Go that way, really fast. If something gets in your way, turn."

                            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