Page 1 of 1
I need help with my homework!
Posted: Tue Feb 09, 2010 9:35 pm
by Disconn3cted
I am supposed to "Evaluate these expressions where A is 11111110 and B is 00000010 using two’s complement."
A+B=?
-B=?
I know how to add binary numbers but I don't know what two's compliment is and my book doesn't give a book explanation on how this relates to arithmetic.
I know 11111110 + 00000010 = 100000000 but I found a website that has the answers to all of the questions in this assignment and the answer is supposed to be 00000000. I'm totally lost, please help me. I don't want the answers. I really want to know how to solve this...
Re: I need help with my homework!
Posted: Tue Feb 09, 2010 9:39 pm
by chickenfeather
Re: I need help with my homework!
Posted: Tue Feb 09, 2010 9:40 pm
by Disconn3cted
chickenfeather wrote:http://en.wikipedia.org/wiki/Two%27s_complement
-edit-
Nevermind, maybe I was over thinking this.
Re: I need help with my homework!
Posted: Tue Feb 09, 2010 10:28 pm
by Smi!ezZ
11111120
and
-10
=]
Re: I need help with my homework!
Posted: Tue Feb 09, 2010 10:32 pm
by Disconn3cted
Smi!ezZ wrote:11111120
and
-10
=]

Re: I need help with my homework!
Posted: Tue Feb 09, 2010 10:33 pm
by Razorhead
My solution:
It's been over a year since I made my last 2-complement's calculation ><
Re: I need help with my homework!
Posted: Tue Feb 09, 2010 11:41 pm
by CrimsonNuker
Dayum. What class is this?
Re: I need help with my homework!
Posted: Wed Feb 10, 2010 12:10 am
by Disconn3cted
CrimsonNuker wrote:Dayum. What class is this?
It is "Introduction to computer science" or Computer Science 111.
I think I figured it out. Two's compliment is used to represent a negative binary number. All the ones and zeros are reversed and then one is added to it. The directions confused me because it sounded like two's compliment was necessary for solving all of them and it wasn't.
Re: I need help with my homework!
Posted: Wed Feb 10, 2010 12:15 am
by CrimsonNuker
Lawl. I'm in gr 12 computer science (ICS4U), and I've never done anything like this, all we do is program shit

Re: I need help with my homework!
Posted: Wed Feb 10, 2010 4:45 am
by BlackFox898
CrimsonNuker wrote:Lawl. I'm in gr 12 computer science (ICS4U), and I've never done anything like this, all we do is program shit

lol same, even the same course code (ICS4U). our teacher is going to teach us C++, but all hes been doing is talking about SDLC and company structure

Re: I need help with my homework!
Posted: Wed Feb 10, 2010 4:58 am
by CrimsonNuker
BlackFox898 wrote:CrimsonNuker wrote:Lawl. I'm in gr 12 computer science (ICS4U), and I've never done anything like this, all we do is program shit

lol same, even the same course code (ICS4U). our teacher is going to teach us C++, but all hes been doing is talking about SDLC and company structure

Everybody I know from other schools are learning C++, but our teacher is making us finish up Visual Basic from ICS3U, then we're moving on the Adobe Flex Builder...
Re: I need help with my homework!
Posted: Wed Feb 10, 2010 6:00 am
by EvGa
Speaking of CS homework here's a problem I'm having trouble with right now...
Read in a text file with the first int declaring 2D array size and then two coordinates (3,0) and (1,3). The coordinates correspond to components in the array. Using a northeast path, ie the ability to move up or right, find and print out all possible paths to the finish cord.
So, from a 5 by 5 2D array, print out all possible paths from (3,0) to (1,3), only allowed up or right movements.
Do this using only
recursion. <---- FML
In java. <---- FML
It's due tomorrow. <---- FML
I've been working on this shit for 4hrs now, I waited until the last day thinking I had it all planned out in my head.. failed when I went to actually code it. I blow at recursion, give me loops any day. Going to be an all-nighter.

EDIT:

Re: I need help with my homework!
Posted: Wed Feb 10, 2010 8:15 am
by Aiyas
Man, did this stuff back when I took Computer Arithmetic(over 3 years ago...)