data representation

This is a discussion on data representation within the C++ Programming forums, part of the General Programming Boards category; Please how to perform the following operation in binary 01110 * 01001 I do not care for the answer if ...

  1. #1
    Absi
    Guest

    data representation

    Please how to perform the following operation in binary

    01110 * 01001

    I do not care for the answer if somebody can lead me to some websites that explain how to add, subtract and multiply those binary it is about data representation. I would appreciate the help

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    The same exact way you'd do it in base 10, cept it's even easier!

    Code:
        01110
      * 01001
    __________
    
        01110
       00000
      00000
     01110
    00000
    __________
    001111110
    Exactly the same except you only are working with multiplication and addition by 1's and 0's rather than 0 through 9

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    Originally posted by Polymorphic OOP
    The same exact way you'd do it in base 10, cept it's even easier!

    Code:
        01110
      * 01001
    __________
    
        01110
       00000
      00000
     01110
    00000
    __________
    001111110
    Exactly the same except you only are working with multiplication and addition by 1's and 0's rather than 0 through 9
    yup, if the current bit is one, you but everything on top down, if not, u put all zeros. then u add. same as normal multiplication. i agree, it's much easier!!!

    .... but not with floating points (demicals)....

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    example of addition:

    Code:
    11 1        borrow area (in carry bit in flag register of cpu)
     1101
    +0101
    =====
    10010

  5. #5
    Absi
    Guest

    Thanks

    Thank you guys for the reply and the explanation, but please if somebody knows about links in the internet on the subject.

  6. #6
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    Do you want a website about the binary operations only or are you learning a Digital Design course?!
    id you are studying Digital Design here is a good link:
    http://www.play-hookey.com/digital/basic_gates.html

    for only binary arithmetic:
    http://www.princeton.edu/~matalive/V...b1/lab1_1.html
    http://fls.cll.wayne.edu/olmt/BINARY/page4.htm

    BTW: you could've use Google.
    none...

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I'm not sure what/why you're doing this. But I think I'd input the binary numbers, save as variables, multiply, then display in binary.

    All variables are actually stored as binary, but getting C++ to input/output binary is not as straight-forward as decimal, hex, or octal.

    Check these out:

    Here are some functions that handle any numeric base up to 36:

    For input:
    strtoul() ANSI (string to long)
    strtod() ANSI (string to double)

    For output:
    ultoa() NON-ANSI Microsoft (unsigned long to string)

    For binary output (ANSI)
    bitset

    Sorry, I don't have any code samples for you. But, sombody posted a bitset sample here recently, so you could search (if this is what you're trying to do.)

  8. #8
    Absi
    Guest

    Data representation

    The reason I'm doing this is because it is one of my courses requirements. It is about how to convert numbers and perform various operation. I also work with BCD binary coded decimal like

    15+15

    00010101+00010101

    Please if there are mor info I would appreciate it. thanks for the reply any way

  9. #9
    Absi
    Guest

    nice web sites ammar

    Ammar, I really appreciate those websites they all what I need, thank you very much for the help.

  10. #10
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953

    Re: Data representation

    Originally posted by Absi
    The reason I'm doing this is because it is one of my courses requirements. It is about how to convert numbers and perform various operation. I also work with BCD binary coded decimal like

    15+15

    00010101+00010101

    Please if there are mor info I would appreciate it. thanks for the reply any way
    What kind of more info you would like to know about?
    I'll be glad to help...
    And I guess I was right you are taking a Digital Design course as a requirment... I was very happy to finish that course, not because it's bad, but because the instructor was awful.

    BTW: do you have a text book?
    none...

  11. #11
    Absi
    Guest

    computer organization

    My be it is the same course but different name. I'm taking now the computer organization course which deals with binary and circuits flip flop and other stuff, I wrote I need more infor before I check the sites that you posted.I guess I'm O.K now. Thank you very much again.

  12. #12
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    If it's dealing with combinational , and sequestial circuits, flip-flops, and that stuff then it's the same thing...

    Anyways, whenever you need some information go to google... for example if you want some info about binary addition, do the following go to google and search for: "binary addition", and you will get many usefull sites, although this is very simple, and almost everybody knows it, some people just don't use it.
    Don't forget Google is students' best friend
    Last edited by ammar; 02-03-2003 at 04:39 AM.
    none...

  13. #13
    Absi
    Guest
    Thanks Ammar for the info I really appreciate it.

  14. #14
    Absi
    Guest
    Sorry Ammar where did you take that course at?It looks like the same course i'm taking. Please you can email me at aka113@psu.edu.Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  2. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  3. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  4. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 08:09 PM
  5. Replies: 1
    Last Post: 07-31-2002, 11:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21