The self-increment operator + + has both prefixes and suffixes, and in conjunction with the indirect access operator *, because of the effects of order, parentheses, and binding relationships, it is easy to misunderstand and produce the wrong
Prefix increment and decrement operators: + + and-Grammar
+ + Unary-expression––unary-expression
NoteThe prefix increment operator (+ +) adds 1 to its operand, which is the result of an expression. The operand must be a left value that is not a
In the previous chapters we have been exposed to the overload of the increment operator, at that time we did not distinguish between the previous increment and the ++a difference, under normal circumstances we are not separate from the a++, but it
The increment operator adds 1 to its operand and returns a numeric value.The increment operator is used in two ways:(1). After use, the operator is behind the operand (such as x + +), then the value is returned before incrementing.(2). Before the
Look at the operator overloads of C #, and find that they are not the same as C + +. Just been in the C # self-increment operator pit, now to share.First define a class class A { publicint i; Public A (int i) {
The code is as follows:Copy code # Include Using namespace std;Class num{Public:Int x;Num () {n = 1; cout Num (int I) {n = I; cout Num (const num & s) {this-> n = s. n; cout ~ Num () {cout Int get () const {return n ;}Void set (int x) {n = x
In the C language, when the pointer operator and + + or – combine to easily divide the order of operations, summarized here, the following is a total of analysis 6 combinations: * p++, (* p) ++,* (p++), ++* p,++ (* p), * (++P).First look at the
Next, let's take a look at the example of the c ++ overload post-auto-addition operator. If you need to learn the C ++ auto-addition operator, you can refer to it.
The Code is as follows:
Copy code
# Include Using namespace
The 4th Chapter weaves the statement into a programHaving learned the various data types in C + +, you know how to use various data types to define variables to describe things in the real world. Now, we can write a payroll statistics program
Transferred from: http://blog.csdn.net/maggiedorami/article/details/7986098Let's look at a program like this:
Public static void Main (string[] args) {
int i, SUM1, sum2;
i=0;
Sum1 = (i++) + (i++);
System.out.println ("sum1=" +sum1)
1. What is the output of the following code?Int main ()
{
Int A [2] = {0, 0 };
Int * P =;
* (P ++) = 1;
Cout System ("pause ");
}
The result is 10, that is, a [0] = 1, a [1] = 0. Although there are Parentheses, p is not first Auto-incrementing. In
The precedence and the binding of operators in C language are often confused, the purpose of this paper is to talk about the difference between them briefly. Here are a few simple examples of how these operators are especially common.The first thing
1. If you do not know the operator priority, the simplest way is to use parentheses to clearly indicate the computing order.
The assignment operation has a very low priority and is executed almost always at the end.
2. If one of the "+" (plus sign)
xTable of Contents [1] unary plus [2] unary minus [3] increment [4] decrement [5] addition [6] subtraction [7] multiplication [8] division [9] seeking the remainder of the wordsArithmetic operations in JavaScript are primarily implemented by
(a) Correct the wrong question1. Output Fahrenheit Celsius temperature conversion table: input two integers lower and upper, output a Zhang Huasi Celsius temperature conversion table, Fahrenheit temperature range is {Lower,upper}, each increase of 2
Prefix and suffix of the auto-increment and auto-increment operators, and suffix of the operator prefix.
There is such a question in the exam:
12
inta = 4;(++a) += i;
Evaluate the value of a. The correct answer is 10.
If you think
Document directory
Left and right
C ++ left value and right value Extension
Use of function objects
Custom function object
Index
Data Structure weapon-private data center STL (on)
Data Structure weapon-private data center STL (medium)
Operator (operator) is used to manipulate data. Operators to compute, check the equation, perform assignments, manipulate variables, and do other, more bizarre work. There are many operators in C + + that do not want to list all, but list the most
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.