• 検索結果がありません。

switch case隴br/>

N/A
N/A
Protected

Academic year: 2021

シェア "switch case隴br/>"

Copied!
2
0
0

読み込み中.... (全文を見る)

全文

(1)

1

switch case

1.1

学習のポイント

複数方向への分岐を行なう制御文switch case文を学びます。

 if else文は、2方向への分岐でしたが、複数方向への多方向分岐を判断する文がありま す。その代表的なものにswitch∼case文があります。

 switchの()の式と、case式1∼式nが比較され、一致するcaseに書かれている文を 実行し、breakでswitch文を抜けます。もしbreakがなければ、次のcaseに書かれてい る文に実行が進みます。

 また一致するcaseがなければdefaultが実行されます。defaultに書くものがなければ 省略しても構いません。

 switch文の式に書ける型はchar、int、enumです。

(2)

1.2

reidai30.c

/* reidai30.c 1 文 字 入 力 し 、そ れ が’b’ ま た は’B’ な ら"basic"、’f’ ま た は’F’ な ら"fortran"、’p’ また は’P’ なら"pascal"、これら以外なら"???"と表示し なさい。 C言語 128頁 */ #include <stdio.h> int main() { int c; c = getchar(); switch(c){ case ’b’: case ’B’: printf("basic\n"); break; case ’f’: case ’F’: printf("fortran\n"); break; case ’p’: case ’P’: printf("pascal\n"); break; default: printf("???\n"); } return 0; } 2

参照

関連したドキュメント

Then, the existence and uniform boundedness of global solutions and stability of the equilibrium points for the model of weakly coupled reaction- diffusion type are discussed..

[r]

“Breuil-M´ezard conjecture and modularity lifting for potentially semistable deformations after

In the case of the KdV equation, the τ -function is a matrix element for the action of the loop group of GL 2 on one-component fermionic Fock space, see for instance [10, 20, 26]..

The information herein is provided “as−is” and onsemi makes no warranty, representation or guarantee regarding the accuracy of the information, product features,

また、同法第 13 条第 2 項の規定に基づく、本計画は、 「北区一般廃棄物処理基本計画 2020」や「北区食育推進計画」、

○○でございます。私どもはもともと工場協会という形で活動していたのですけれども、要

Core reset: tertiary winding, RCD clamp, 2-switch forward 3.. Closed-loop feedback: simulations and