Leak Society - The Home Of Nulled Resources.
Forum Beta v1 Now Live!
C/C++
Thead Owner : Kurt Manion, Category : Everything Coding, 14 Comment, 443 Read
Viewers: 2 Guest(s)
Member
***
167
Messages
19
Threads
0
Rep
4 Years of Service
08-14-2011, 12:59 PM
#5
during my extended leave due to me moving states.
I learned C and C++
yay! So I'm doing a tutorial seris on it, and I have two tutorials to upload

I'll be posting tutorials every day, if I can

we'll start with C, and move into C++

tut1: Maths

C/C++ math is similar in every way to GM/SC math, except a few added features
we'll review the features of GM/SC/ math
- the basic math operators +-*/
- the inability of the complier to square, or root (there is a way to do this in C, but we'll discuss this later)
- allows variable to be used in it
the additional features are:
- you don't need spaces in between characters
- three additional operators
- different use of the equal sign


modulus:
[spoiler]the modulus operator is a simple, yet weird addition that is essential.
it looks like this '%' and finds the remainder of a division.
ie.  5 % 2 = x
this would set x to 1, because 5 divided by two has a remainder of 1
22 % 10 = x
x = 2

you use this for verifying whole numbers, and for isolating didgits[/spoiler]

increment operator:
[spoiler]I really shouldn't tell you guys about this, because I can't fully elaborate on it's uses, without losing you.
treat this as part one of increment operators
increment opperators syntax examples are as follow
i++ ++i i-- --i
these are all the different uses of it. they add/subtract by one.
i being of type
int
float
double
short
unsigned
char

these will be more explained tomorrow when I enumerate on types. so the above, in laymen terms, is anynumber (or a char, which would increase it's ASCII value, but is a bad programing practice)
currently treat
++i, and i++ (and the minus versions)
as the same, but there's a small difference that we'll explain latter[/spoiler]

assignment opperator/ use of the equal sign:
[spoiler]two concepts in one.
The equal sign written as '=' is the assignment operator. as in 3+4=x
assignes the value of 6 to x, and when used as '==' it checks for equality.
where it either evaluates to 0 or 1, whether it's false or true(in that order)
this is used with function such as if()
again this is something we'll explain later with functions

back to assignment operators
the statements
x = x + 1
and
x += 1
are equivalent.
you can do this with al of the other operators

+=
-=
/=
*=
%=

and some other operators called the bitwise operators, that we won't cover.

here's some more syntax examples
variable_with_a_stupid_long_name = variable_with_a_stupid_long_name / 8
and
variable_with_a_stupid_long_name /= 8

now you can see it's use^
cake -= 5
[/spoiler]

P.S. typing these lines straight into a C compiler won't work.
good luck feel free to ask questions 
P.P.S it took me so long to re post, because it kept taking off the end, because I used bullet points. I don't know what the deal is, but there rolling now, I'll post the wrap-up video latter today.


Messages In This Thread
C/C++ - by Kurt Manion - 08-12-2011, 12:35 AM
C/C++ - by Taz - 08-13-2011, 07:57 PM
C/C++ - by Gan - 08-13-2011, 08:16 PM
C/C++ - by Kurt Manion - 08-14-2011, 12:57 PM
C/C++ - by Kurt Manion - 08-14-2011, 12:59 PM
C/C++ - by Kurt Manion - 08-16-2011, 04:09 PM
C/C++ - by Kurt Manion - 08-16-2011, 04:10 PM
C/C++ - by Kurt Manion - 08-16-2011, 04:16 PM
C/C++ - by Kurt Manion - 08-16-2011, 05:06 PM
C/C++ - by Kurt Manion - 08-27-2011, 11:08 PM
C/C++ - by Kurt Manion - 09-04-2011, 09:01 PM
C/C++ - by Kurt Manion - 09-05-2011, 03:38 PM
C/C++ - by Kurt Manion - 09-08-2011, 09:00 PM
C/C++ - by Kurt Manion - 09-19-2011, 09:57 PM
C/C++ - by Kurt Manion - 09-22-2011, 10:49 PM

Forum Jump: