![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 4
![]() |
Yeah I guess thats true... never had much interest in binary math.
I rather use ints or hex.
__________________
coffee is my heroin. |
|
|
|
|
|
#12 | |
|
Programmer
Join Date: Oct 2004
Location: Canada
Posts: 82
Rep Power: 4
![]() |
Quote:
0110 0010 = positve 1000 1010 = negative And the positive is always a straight calculation, while the negative is a quick inverse, followed by adding one, and than make the value negative. |
|
|
|
|
|
|
#13 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 4
![]() |
My mistake!
__________________
coffee is my heroin. |
|
|
|
|
|
#14 | ||||
|
Programmer
Join Date: Oct 2004
Posts: 73
Rep Power: 4
![]() |
Quote:
![]() Quote:
It's OK. I know you are tired! Quote:
![]() And just to make sure I understand, is this right: If we run the following on the command line: myBigProgram.exe -l 66 -n program.txt It will look like this: argc = 5 argv[0] = "myBigProgram.exe"; argv[1] = "-l" argv[2] = 66 argv[3] = "-n" argv[4] = "program.txt" argv[0][0] = 'm' argv[0][1] = 'y' argv[0][2] = 'B' argv[0][3] = 'i' argv[0][4] = 'g' argv[0][5] = 'P' argv[0][6] = 'r' argv[0][7] = 'o' argv[0][8] = 'g' argv[0][9] = 'r' argv[0][10] = 'a' argv[0][11] = 'm' argv[0][12] = '.' argv[0][13] = 'e' argv[0][14] = 'x' argv[0][15] = 'e' argv[1][0] = '-' argv[1][1] = 'l' argv[2][0] = '6' //Is this right, it is a number argv[2][1] = '6' //Is this right, it is a number argv[3][0] = '-' argv[3][1] = 'n' argv[4][0] = 'p' argv[4][1] = 'r' argv[4][2] = 'o' argv[4][3] = 'g' argv[4][4] = 'r' argv[4][5] = 'a' argv[4][6] = 'm' I have a feeling this isn't right? Anyway, thanks guys for your replies! Very much appreciated! Cheers! ![]() Quote:
|
||||
|
|
|
|
|
#15 | |||
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 4
![]() |
Quote:
A- O.K. (couldn't be better, and I'm not saying that just because you have a nice a.. hmmm avatar). Actualy doesn't matter if you type a number ... the system still reads it as a char ... later on you convert it with atoi() atof() etc. depending on what kind of num it is... Quote:
no explanation required... you get the point...I'm still tired. Quote:
(easiest explanation is that you have 256 available values when using 8 bits, out theese 256 values one of them has to be zero therefore it's not possible to have the same number of positive and negative values... thus 127) If i wasn't clear ... no wories You realy don't need to know or understand this at this point... And if you do, good for you... now quickly forget it (format your drive ) or you'll have nightmares...I know i do... :blink:
__________________
coffee is my heroin. |
|||
|
|
|
|
|
#16 |
|
Programmer
Join Date: Oct 2004
Location: Canada
Posts: 82
Rep Power: 4
![]() |
I have to fix my screw up: Regarding two's compliment:
Maximum positive 8 bit# = 0111 1111 = 1+2+4+8+16+32+64+0 = 127 Simple enought Maximum negative 8 bit# = 1000 0000 = 0111 1111 = 1000 0000 = 0+0+0+0+0+0+0+128 = -128 So it works perfectly, if you do your addition properly. |
|
|
|
|
|
#17 | |
|
Programmer
Join Date: Oct 2004
Posts: 73
Rep Power: 4
![]() |
Quote:
![]() Sure will do. Thanks for the help guys! Very much appreciated. Cheers ![]() |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|