You can apply the modifiers signed, unsigned, short and long to character and integer base types. However you may also apply long to double.
It provides operators for five basic arithmetic calculation : addition, subtraction, multiplication, division and remainder which are +, -, *, / and % respectively.
|+||addition||6 + 5||11|
|-||subtraction||6 - 5||1|
|*||multiplication||6 * 5||30|
|/||division||60 / 5||12|
|%||addition||60 % 5||0|
C++ includes two useful operators these are the increment and decrement operators, ++ and --. The C++ name itself is influenced by the increment operator ++. The operator ++ add 1 to its operand, and -- subtract 1.
a = 15;
a++ or ++a will produce the result a = 16.
a = 15;
a-- or --a will produce the result a = 14.
Note : That a++ and a-- are referring the post-fix increment and decrement operation, and ++a and --a are referring the prefix increment and decrement operation.
Relation refers to the relationships that values (or operands) can have with one another.
|==||comparison (equality)||6 == 5||false|
|<||less than||6 < 5||false|
|<=||less than or equal to||6 <= 5||false|
|>||greater than||6 > 5||true|
|>=||greater than or equal to||6 >= 5||true|
|!=||not equal to||6 != 5||true|
The previous section discussed about relational operators that establish relationships among the values. This selection talks about logical operators that refer to the ways these relationships (among values) can be connected.
|&&||and||(6 <= 6) && (5 < 3)||false|
|||||Or||(6 <= 6) || (5 < 3)||true|
|!||Or||!(6 <= 6)||false|
C++ offers a conditional operator (?:) that stores a value depending upon a condition, this operator also called Ternary operator. The general condition follows :
expression1? expression2 : expression3
The identifier result will have value 'P' if the test expression marks >= 50 evaluates to true(1) otherwise result will have 'F'.
There are a lot many other operators in C++, other than the ones discussed here. But in this section, we are discussing two of them that are of relevant use to you right now. two operators are : sizof and comma operator.
The sizeof Operator :
cout<<"The sizeof float variable fl is"<<sizeof fl;
cout<<"The sizeof integers is"<<sizeof (int);
Note : Assuming that integer-size is 2 bytes and float-size is 8 bytes.
The Comma Operator :
b = ( a = 3, a + 1 );
First assigns a value 3 and then assigns b the value a + 1.
Note : The parentheses are necessary because the comma operator has a lower precedence than the assignment operator.
We create a new YouTube channel (NightHawk) for gaming purpose like online games streaming or games review.
We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels
Protection died IPs active, this IP range is not allowed !