回覆列表
  • 1 # Affgcff

    1)簡化形式 if(表示式) 語句塊 如: if(x>y) printf(“%d”,x);

    2)一般形式 if (表示式) 語句塊1 else 語句塊2 例如: if (x>y) printf(“max=%d”,x); else printf(“max=%d”,y);

    3)巢狀形式含義:一條if語句重又包含另一個if語句稱為if語句的巢狀.格式:if( ) if( ) 語句塊1 else 語句塊2else if( ) 語句塊3 else 語句塊4例如:if (score>90) printf(“very good”);else if(score>80) printf(“good”); else if(score>60) printf(“ok”); else printf(“bad”); 如果語句塊包含多個語句,用{}就行了例如:if(n>0){ printf("%d",n); printf("是正數\n");}

  • 中秋節和大豐收的關聯?
  • 現在買火車票怎麼一直都是沒有餘票建議搶票?動車高鐵票都很少?