# data representation

• 02-01-2003
Absi
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
• 02-01-2003
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
• 02-01-2003
Speedy5
Quote:

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)....
• 02-01-2003
Speedy5

Code:

```11 1        borrow area (in carry bit in flag register of cpu)  1101 +0101 ===== 10010```
• 02-02-2003
Absi
Thanks
• 02-02-2003
ammar
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

• 02-02-2003
DougDbug
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.)
• 02-02-2003
Absi
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
• 02-02-2003
Absi
nice web sites ammar
Ammar, I really appreciate those websites they all what I need, thank you very much for the help.
• 02-02-2003
ammar
Re: Data representation
Quote:

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

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?
• 02-02-2003
Absi
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.
• 02-02-2003
ammar
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
• 02-03-2003
Absi
Thanks Ammar for the info I really appreciate it.
• 02-03-2003
Absi
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