Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of C++ operator

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "C++ operator example Analysis", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn the "C++ operator example analysis" bar!

Examples of commonly used C++ operators:

The arithmetical operator + plus x quoz;-minus x quoz; * multiplicates x quoz; / divides x quoz; assignment operator = assignment x times 10; + = assignment and and x times 10; (equal to xx=x+10;)-= assignment and subtraction x words 10; * = assignment and division x\ = 10; & = assignment bits and x parts 0x02; | = assignment bits or x | = 0x02 Logic operator & & Logic and if (x & & 0xFF) {...} | Logic or if (x | | 0xFF) {...} equation operator = = equal to if (x = = 10) {...}! = not equal to if (x! = 10) {...}

< 小于 if(x < 10) {...} >

Greater than if (x > 10) {...} = 10) {...} unary operator * indirect operator int x operators; & address operator int* x operators; ~ bit non-x & = ~ 0x02;! Logical non-if (! valid) {...} + increment operator Xray + (equal to xx=x+1;)-- decrement operator XMurray; class and structure operators:: range resolution MyClass:: SomeFunction ();-> indirect member MyClass- > SomeFunction (); direct member MyClass. SomeFunction ()

As you can see, this list is too long to remember at once. When using the C++ operators, you will gradually become familiar with these operators. It is important to note that the increment operator can be used as either pre-increment (+ + x) or post-increment (xincrement +). The pre-increment operator tells the compiler to increment before using the variable, and then the increment operator tells the compiler to use the value of the variable before incrementing. For example, the following code:

Int x = 10; cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report