首頁 考試吧論壇 Exam8視線 考試商城 網(wǎng)絡(luò)課程 模擬考試 考友錄 實(shí)用文檔 求職招聘 論文下載
2011中考 | 2011高考 | 2012考研 | 考研培訓(xùn) | 在職研 | 自學(xué)考試 | 成人高考 | 法律碩士 | MBA考試
MPA考試 | 中科院
四六級(jí) | 職稱英語 | 商務(wù)英語 | 公共英語 | 托福 | 雅思 | 專四專八 | 口譯筆譯 | 博思 | GRE GMAT
新概念英語 | 成人英語三級(jí) | 申碩英語 | 攻碩英語 | 職稱日語 | 日語學(xué)習(xí) | 法語 | 德語 | 韓語
計(jì)算機(jī)等級(jí)考試 | 軟件水平考試 | 職稱計(jì)算機(jī) | 微軟認(rèn)證 | 思科認(rèn)證 | Oracle認(rèn)證 | Linux認(rèn)證
華為認(rèn)證 | Java認(rèn)證
公務(wù)員 | 報(bào)關(guān)員 | 銀行從業(yè)資格 | 證券從業(yè)資格 | 期貨從業(yè)資格 | 司法考試 | 法律顧問 | 導(dǎo)游資格
報(bào)檢員 | 教師資格 | 社會(huì)工作者 | 外銷員 | 國際商務(wù)師 | 跟單員 | 單證員 | 物流師 | 價(jià)格鑒證師
人力資源 | 管理咨詢師考試 | 秘書資格 | 心理咨詢師考試 | 出版專業(yè)資格 | 廣告師職業(yè)水平
駕駛員 | 網(wǎng)絡(luò)編輯
衛(wèi)生資格 | 執(zhí)業(yè)醫(yī)師 | 執(zhí)業(yè)藥師 | 執(zhí)業(yè)護(hù)士
會(huì)計(jì)從業(yè)資格考試會(huì)計(jì)證) | 經(jīng)濟(jì)師 | 會(huì)計(jì)職稱 | 注冊(cè)會(huì)計(jì)師 | 審計(jì)師 | 注冊(cè)稅務(wù)師
注冊(cè)資產(chǎn)評(píng)估師 | 高級(jí)會(huì)計(jì)師 | ACCA | 統(tǒng)計(jì)師 | 精算師 | 理財(cái)規(guī)劃師 | 國際內(nèi)審師
一級(jí)建造師 | 二級(jí)建造師 | 造價(jià)工程師 | 造價(jià)員 | 咨詢工程師 | 監(jiān)理工程師 | 安全工程師
質(zhì)量工程師 | 物業(yè)管理師 | 招標(biāo)師 | 結(jié)構(gòu)工程師 | 建筑師 | 房地產(chǎn)估價(jià)師 | 土地估價(jià)師 | 巖土師
設(shè)備監(jiān)理師 | 房地產(chǎn)經(jīng)紀(jì)人 | 投資項(xiàng)目管理師 | 土地登記代理人 | 環(huán)境影響評(píng)價(jià)師 | 環(huán)保工程師
城市規(guī)劃師 | 公路監(jiān)理師 | 公路造價(jià)師 | 安全評(píng)價(jià)師 | 電氣工程師 | 注冊(cè)測(cè)繪師 | 注冊(cè)計(jì)量師
繽紛校園 | 實(shí)用文檔 | 英語學(xué)習(xí) | 作文大全 | 求職招聘 | 論文下載 | 訪談 | 游戲
您現(xiàn)在的位置: 考試吧(Exam8.com) > 軟件水平考試 > 復(fù)習(xí)資料 > 程序員資料 > 正文

2011年軟考程序員考試復(fù)習(xí)筆試知識(shí)點(diǎn)整理(8)

考試吧提供了“2011年軟考程序員考試復(fù)習(xí)筆試知識(shí)點(diǎn)整理”,供考生參考。

  更多:2011年軟考程序員考試復(fù)習(xí)筆試知識(shí)點(diǎn)整理匯總

  12、C++操作符優(yōu)先級(jí):

  記憶方法:

  去掉一個(gè)最高的,去掉一個(gè)最低的,剩下的是一、二、三、賦值;雙目運(yùn)算符中,順序?yàn)樗阈g(shù)、關(guān)系和邏輯,移位和邏輯位插入其中。

--摘自《C語言程序設(shè)計(jì)實(shí)用問答》

  問題:如何記住運(yùn)算符的15種優(yōu)先級(jí)和結(jié)合性?

  解答:C語言中運(yùn)算符種類比較繁多,優(yōu)先級(jí)有15種,結(jié)合性有兩種。

  如何記憶兩種結(jié)合性和15種優(yōu)先級(jí)?下面講述一種記憶方法。

  結(jié)合性有兩種,一種是自左至右,另一種是自右至左,大部分運(yùn)算符的結(jié)合性是自左至右,只有單目運(yùn)算符、三目運(yùn)算符的賦值運(yùn)算符的結(jié)合性自右至左。

  優(yōu)先級(jí)有15種,記憶方法如下:

  記住一個(gè)最高的:構(gòu)造類型的元素或成員以及小括號(hào)。

  記住一個(gè)最低的:逗號(hào)運(yùn)算符。

  剩余的是一、二、三、賦值——意思是單目、雙目、三目和賦值運(yùn)算符。

  在諸多運(yùn)算符中,又分為:算術(shù)、關(guān)系、邏輯。

  兩種位操作運(yùn)算符中,移位運(yùn)算符在算術(shù)運(yùn)算符后邊,邏輯位運(yùn)算符在邏輯運(yùn)算符的前面。

  再細(xì)分如下:

  算術(shù)運(yùn)算符*,/,%高于+,-。

  關(guān)系運(yùn)算符中:>,>=,<和<=高于==,!=。

  邏輯運(yùn)算符中,除了邏輯求反(!)是單目外,邏輯與(&&)高于邏輯或(||)。

  邏輯位運(yùn)算符中,除了邏輯按位求反(~)外,按位與(&)高于按位半加(^),高于按位或(|)。

Prece dence Operator Description Example Over loadable Associativity
1 :: Scope resolution operator Class::age = 2; no left to right
2 () Function call printf(“Hello world\n”); yes left to right
() Member initalization c_tor(int x, int y) : _x(x), _y(y * 10) {} yes
[] Array access array[4] = 2; yes
-> Member access from a pointer ptr->age = 34; yes
. Member access from an object obj.age = 34; no
++ Post-increment for (int i = 0; i < 10; i++) cout << i; yes
-- Post-decrement for (int i = 10; i > 0; i--) cout << i; yes
dynamic_cast Runtime-checked type conversion Y& y = dynamic_cast<Y&>(x); no
static_cast Unchecked type conversion Y& y = static_cast<Y&>(x); no
reinterpret_cast Reinterpreting type conversion int const* p = reinterpret_cast<int const*>(0x1234); no
const_cast Cast away/Add constness int* q = const_cast<int*>(p); no
typeid Get type information std::type_info const& t = typeid(x); no
3 ! Logical negation if (!done) ... yes right to left
not Alternate spelling for !
~ Bitwise complement flags = ~flags; yes
compl Alternate spelling for ~
++ Pre-increment for (i = 0; i < 10; ++i) cout << i; yes
-- Pre-decrement for (i = 10; i > 0; --i) cout << i; yes
- Unary minus int i = -1; yes
+ Unary plus int i = +1; yes
* Dereference int data = *intPtr; yes
& Address of int *intPtr = &data; yes
sizeof Size (of the type) of the operand in bytes size_t s = sizeof(int); no
new Dynamic memory allocation long* pVar = new long; yes
new [] Dynamic memory allocation of array long* array = new long[20]; yes
delete Deallocating the memory delete pVar; yes
delete [] Deallocating the memory of array delete [] array; yes
(type) Cast to a given type int i = (int)floatNum; yes
4 ->* Member pointer selector ptr->*var = 24; yes left to right
.* Member object selector obj.*var = 24; no
5 * Multiplication int i = 2 * 4; yes left to right
/ Division float f = 10.0 / 3.0; yes
% Modulus int rem = 4 % 3; yes
6 + Addition int i = 2 + 3; yes left to right
- Subtraction int i = 5 - 1; yes
7 << Bitwise shift left int flags = 33 << 1; yes left to right
>> Bitwise shift right int flags = 33 >> 1; yes
8 < Comparison less-than if (i < 42) ... yes left to right
<= Comparison less-than-or-equal-to if (i <= 42) ... yes
> Comparison greater-than if (i > 42) ... yes
>= Comparison greater-than-or-equal-to if (i >= 42) ... yes
9 == Comparison equal-to if (i == 42) ... yes left to right
eq Alternate spelling for ==
!= Comparison not-equal-to if (i != 42) ... yes
not_eq Alternate spelling for !=
10 & Bitwise AND flags = flags & 42; yes left to right
bitand Alternate spelling for &
11 ^ Bitwise exclusive OR (XOR) flags = flags ^ 42; yes left to right
xor Alternate spelling for ^
12 | Bitwise inclusive (normal) OR flags = flags | 42; yes left to right
bitor Alternate spelling for |
13 && Logical AND if (conditionA && conditionB) ... yes left to right
and Alternate spelling for &&
14 || Logical OR if (conditionA || conditionB) ... yes left to right
or Alternate spelling for ||
15 ? : Ternary conditional (if-then-else) int i = a > b ? a : b; no right to left
16 = Assignment operator int a = b; yes right to left
+= Increment and assign a += 3; yes
-= Decrement and assign b -= 4; yes
*= Multiply and assign a *= 5; yes
/= Divide and assign a /= 2; yes
%= Modulo and assign a %= 3; yes
&= Bitwise AND and assign flags &= new_flags; yes
and_eq Alternate spelling for &=
^= Bitwise exclusive or (XOR) and assign flags ^= new_flags; yes
xor_eq Alternate spelling for ^=
|= Bitwise normal OR and assign flags |= new_flags; yes
or_eq Alternate spelling for |=
<<= Bitwise shift left and assign flags <<= 2; yes
>>= Bitwise shift right and assign flags >>= 2; yes
17 throw throw exception throw EClass(“Message”); no
18 , Sequential evaluation operator for (i = 0, j = 0; i < 10; i++, j++) ... yes left to right

  相關(guān)推薦:

  軟考程序員考試歷年真題重點(diǎn)題總結(jié)及答案

  2011年上半年軟考報(bào)名時(shí)間及方式匯總

  軟考程序員考試歷年真題匯總(2007年-2010年)

文章搜索
軟件水平考試欄目導(dǎo)航
版權(quán)聲明:如果軟件水平考試網(wǎng)所轉(zhuǎn)載內(nèi)容不慎侵犯了您的權(quán)益,請(qǐng)與我們聯(lián)系800@exam8.com,我們將會(huì)及時(shí)處理。如轉(zhuǎn)載本軟件水平考試網(wǎng)內(nèi)容,請(qǐng)注明出處。