|  |
08-26-2008, 10:35 PM
|
#1 (permalink)
|
Newb Techie Join Date: Aug 2008 Posts: 13
| Noob at C++, just looking for some beginner help. I'm trying to learn some stuff in C++, ultimately be able to design things, such as games..etc.
I know that will be a LONG time from now, as there's already stuff I'm not understanding.
But just to get kick off the learning experience..I'm reading
a tutorial type thing online.
I've came across this part,
"n addition to decimal numbers (those that all of us are used to use every day) C++ allows the use as literal constants of octal numbers (base 8) and hexadecimal numbers (base 16). If we want to express an octal number we have to precede it with a 0 (zero character). And in order to express a hexadecimal number we have to precede it with the characters 0x (zero, x). For example, the following literal constants are all equivalent to each other:
75 // decimal
0113 // octal
0x4b // hexadecimal
All of these represent the same number: 75 (seventy-five) expressed as a base-10 numeral, octal numeral and hexadecimal numeral, respectively. "
I'm not understanding how..
0113 and 0x4b=75? |
| |
08-26-2008, 10:55 PM
|
#2 (permalink)
|
Newb Techie Join Date: Aug 2008 Posts: 16
| Re: Noob at C++, just looking for some beginner help. If your goal is to develop games then you're going to need a serious grasp for C++ or C to begin with.
Then you will need some Win32 API knowledge for basics like creating windows and such.
You will also need to learn a graphics library API such as DirectX or OpenGL.
To go along with that you're going to need to be competent with mathematics such as trigonometry.
I suggest getting some books and online tutorials and getting stuck into writing programs. Stick with it. That's the key! |
| |
08-27-2008, 12:14 AM
|
#3 (permalink)
|
Newb Techie Join Date: Aug 2008 Posts: 13
| Re: Noob at C++, just looking for some beginner help. :eek: I'm 16. and math is my weak subject!
Time to start reading I guess.
trigonometry sounds oh so fun. |
| |
08-27-2008, 08:59 AM
|
#4 (permalink)
|
Software Developer Join Date: Mar 2006 Location: Columbus, OH Posts: 569
| Re: Noob at C++, just looking for some beginner help. |
| |
08-31-2008, 04:02 AM
|
#5 (permalink)
|
Join Date: Sep 2005 Location: Toronto, Canada Posts: 5,418
| Re: Noob at C++, just looking for some beginner help. Basically Octal numbers can go up to 8 and Hex go up to 16.
So Decimal 7 = Octal 7, however a decimal value of 8 = an Octal value of 10. Add one to the next number and then keep going up again:
Decimal 9 = Octal 11
D 10 = O 12
D 16 = O 20
D 17 = O 21
D 24 = O 30
D 32 = O 40
D 40 = O 50
D 48 = O 60
D 56 = O 70
D 63 = O 77 - Once again the second number cannot pass 8 so you move to the third.
D 64 = O 100
D 72 = O 110
D 75 = O 113
For Hex take the 0x away first off. That's just there to let the C++ compiler know that you want the number to be used as a hex value.
D 1 = H 1
D 9 = H 9
As soon as the decimal goes to 10 hex switches to the letters A through F.
D 10 = H A
D 15 = H F
Then just use the same method for octal. Once the hex value can't go any higher for the first digit move to the second and add one.
D 16 = H 10
D 31 = H 1F
D 32 = H 20
D 48 = H 30
D 64 = H 40
D 73 = H 49
D 74 = H 4A
D 75 = H 4B
It is tough to explain but I hope that helps.
Last edited by Baez; 08-31-2008 at 04:13 AM.
|
| |
08-31-2008, 07:09 AM
|
#6 (permalink)
|
01001100011011110110110 Join Date: Mar 2007 Location: Perth, Australia Posts: 1,870
| Re: Noob at C++, just looking for some beginner help. I haven't met anyone who uses octal tho. hex yeah. use that a LOT, way easier to type things in hex than in a long string of binary.
__________________ "As a result of all this hardship, dirt, thirst, and wombats, you would expect Australians to be a dour lot. Instead, they are genial, jolly, cheerful, and always willing to share a kind word with a stranger, unless they are an American." -- Douglas Adams Click this if I helped you >>>> <<<< |
| |
09-07-2008, 02:46 PM
|
#7 (permalink)
|
Over and Above Person Join Date: Jun 2008 Posts: 694
| Re: Noob at C++, just looking for some beginner help. You guys are ruining math for me, this is too hard, even with the explanation I dont get it.
__________________ ANTEC 900: Gigabyte Ga-Ep35-DS3P : THERMALTAKE (700 watts) :
4 GB G.SKILL 1000 mhz Intel Quad Core (Q6600)
ATI 4870 ARTIC COOLER FAN
WD 640 and 22x DVD burner |
| |
09-07-2008, 07:18 PM
|
#8 (permalink)
|
Join Date: Sep 2005 Location: Toronto, Canada Posts: 5,418
| Re: Noob at C++, just looking for some beginner help. Really? I thought my explanation was pretty straight forward. |
| |
09-07-2008, 08:55 PM
|
#9 (permalink)
|
01001100011011110110110 Join Date: Mar 2007 Location: Perth, Australia Posts: 1,870
| Re: Noob at C++, just looking for some beginner help. ok, try binary first then. There are only two possible values: 1 and 0. All you need to know is that 0+0=0, 0+1=1, and 1+1=10 (NOT ten, but One Zero) It's very important that you keep in mind that if you see 1000 in binary it's 'One Zero Zero Zero'.
so you'd count like this:
00 (0 decimal)
01 (1) ------ when I added 1 to 00 I got 01, (0+1=1)
10 (2) ------ when I added 1 to 01 I got 10, (1+1=10)
11 (3) ------ when I added 1 to 10 I got 11, (0+1=1)
100 (4) ------ when I added 1 to 11 I got 100, (1+1=10)
The last example maybe needs a bit more explaining. Taking the problem one digit at a time:
we added "1" to the first digit in "11". 1+1=10.
Now we have "0" where the first "1" used to be, and the "1" from our "10" answer is in the same place as the second "1" in "11" e.g. 1(1-on-top-of-other-1)0
With the two 1's in the same place, they need to be added. 1+1=10
So our final answer is 'OneZeroZero' or '100'
__________________ "As a result of all this hardship, dirt, thirst, and wombats, you would expect Australians to be a dour lot. Instead, they are genial, jolly, cheerful, and always willing to share a kind word with a stranger, unless they are an American." -- Douglas Adams Click this if I helped you >>>> <<<< |
| |  | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |