ApexGaming
Welcome to ApexGaming! if you haven't already please register and account and or login! Very Happy, if you have already registered and do not wish to see this again, simply click "Do not desplay again" so this will stop annoying the fuck out of you! ^-^

Thanks and Enjoy ApexGaming!
ApexGaming
Welcome to ApexGaming! if you haven't already please register and account and or login! Very Happy, if you have already registered and do not wish to see this again, simply click "Do not desplay again" so this will stop annoying the fuck out of you! ^-^

Thanks and Enjoy ApexGaming!
ApexGaming
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Almost as exciting as sex!
 
HomePortalGalleryLatest imagesSearchRegisterLog in

 

 C++ Notes

Go down 
AuthorMessage
KillerQueen
ApexGaming Co-Owner



Posts : 132
Join date : 2009-03-28
Age : 29
Location : California

C++ Notes Empty
PostSubject: C++ Notes   C++ Notes I_icon_minitimeSat Mar 28, 2009 7:26 pm

Thought i would keep this updated time to time, as i found a good Ebook to teach me step by step C++ as well as making files, running them, creating expressions, keywords and alot of other things, this is what i have for you so far:

Constans are the fixed values that do not change during the programs execution.

-Rules for Constructing Variable Names-

-A variable name is any combination of 1 to 8 alphabets,digits,or underscores, some compilers allow variable name whos length can be uo to 40

characters.

-the first character in the variable name, must be an alphabet

-No commas or spaces are allowed withing the variable name

-No special symbols other than an underscore can be used in a variable name.

-Uppercase and lowercase are significant. That is the variavle tota is not the same as total or TOTAL.

-The variable should not be a keyword

-white space is not allowed..

The Assignment operator is used for assigning a value to a variable, the syntax for this is like this.

General Format-
Variable =expression;

-Example-
year = 2004;
age = year - dob;
i = i + 1;


The logical operators are used to combine two expressions

C++ includes two useful operators not generally found in other programming languages these are the Increment(++) and Decrement operators(-

-).
The operator ++ adds 1 to itts operand and -- subtracts one. In other words x = x+1 is the same as ++x and x= x-1 is the same as --x


Prefix-
First incriments/decremnts and then assigns the value
Postfix- First assigns the value and then Increments/Decrements

The increment and Decrement operators can either be used as a prefix or a postfix to the variable. ++ variable and variable ++ have DIFFERENT.

meening.

The prefix operator ++ variable or -- variable first increments or decrements the value as they case may be, and then assings the value to the

variable. On the contratry, The postfix operator Variable ++ or variable -- first assings the value, and then increments and decrements the value

of the variable.

Prefix ++variable --variable
Postfix variable++ variable--


The conditional operators(also known as ternary operators) and '?' and ':', these are used to construct conditional expressions.

EX.

exp = exp 1 ? exp 2:exp 3:

? : - Conditional Operator


------------------
Example--

if exp1 is true

then exp=exp2:

else exp=exp3:


Expression one is evaluated first, if it is true than expression 2 is evaluated and becomes the value of the expression, but in case if expression 1 is false, than expression 3 is evaluated and its value becomes the expression.

Examples of Conditonal Operator--

m = 15:

n = 8:

z = (m>n) ? M : n:


In that example, the variable m is assigned a value of 15 and n is assigned the value of 8. Here, in the state ment shown in the figure, first the condition m>n is checked, IF the condition returns false the value of n is assigned to the variable z. hence z would contain the value of n.

a = -10:

n = -last;



Unary Minus Operator
- negates the value of a number or variable. It is equivalent to multiplying the value of the number or variable by -1 the figure shows some examples of unary minus operator.

Back to top Go down
https://apexgaming.darkbb.com
 
C++ Notes
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
ApexGaming :: ApexGaming Community :: Coding and Programming-
Jump to: