Noob at C++, just looking for some beginner help.

Status
Not open for further replies.

MR2SUFI

Solid State Member
Messages
13
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?
 
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!
 
:eek: I'm 16. and math is my weak subject!
Time to start reading I guess.
trigonometry sounds oh so fun.
 
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.
 
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.
 
You guys are ruining math for me, this is too hard, even with the explanation I dont get it.
 
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'
 
Status
Not open for further replies.
Back
Top Bottom