明解 C++ 教學手冊 柴田望洋 博士 著
Post on 11-Jan-2016
547 Views
Preview:
DESCRIPTION
明解 C++ 教學手冊 柴田望洋 博士 著. 第二章 程式流程的分歧. 本章所要學習的是各種運算子,以及用來讓程式流程分歧的 if 敘述和 switch 敘述。. 2-1 if 敘述. if 敘述 ( 其一 ). 語法: if ( 條件 ) 敘述 只有在 條件 (condition) 成立時才會執行 敘述 。 true 和 false 是被稱為 布林常值 (boolean literal) 的 bool 型態的值。. if 敘述 ( 其二 ) 語法: if( 條件 ) 敘述 else 敘述 - PowerPoint PPT Presentation
Transcript
C++
ifswitch
if ()
if () (condition)truefalse(boolean literal)bool
if ()if() else truefalse
(equality)==!=
!(logical negative operator)
ififif
(expression)c + 32a = c + 32(evaluation)
(expression statement)
(null statement)
&&||(logical operator)
&&x&&yxy
|| x||yxy
if
(conditional operator)(conditional expression)
(algoruthm)
{ }(block)(compound statement)
(sort)
if
%
switch
switchcase1:(label)breakswitch
casedefault:
ifswitchswitchifswitch(selection statement)
(keyword)
(alternative representation)
(identifier)
(punctuator)
(precedence)
(associativity)
boolbool0true0falseif
if~elseswitchswitchbreakcasedefaultswitchbreakifswitchifswitchifswitch{ }0typexy{ type t = x; x = y; y = t; }
- typexy(x
top related