C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

Similar documents
£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx

‚æ4›ñ

PowerPoint Presentation

P03.ppt

P05.ppt

プログラミング基礎

8 / 0 1 i++ i 1 i-- i C !!! C 2

C言語によるアルゴリズムとデータ構造

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

tuat1.dvi

初歩のC言語ターミナル_2014_May.pages

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

C C UNIX C ( ) 4 1 HTML 1

char int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t

Microsoft Word - C.....u.K...doc

P02.ppt

新版明解C言語入門編

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

PowerPoint プレゼンテーション

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B

プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; } Point; 問題 18. 問題 17 の

P06.ppt

Microsoft PowerPoint - 説明2_演算と型(C_guide2)【2015新教材対応確認済み】.pptx

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード]

プログラミング基礎

4 分岐処理と繰返し処理 ( 教科書 P.32) プログラムの基本的処理は三つある. (1) 順次処理 : 上から下に順番に処理する ぶんきそろ (2) 分岐処理 : 条件が揃えば, 処理する はんぷく (3) 反復処理 : 条件が揃うまで処理を繰り返す 全てのプログラムは (1) から (3) の

‚æ2›ñ C„¾„ê‡Ìš|

超初心者用

Microsoft PowerPoint - class04.ppt

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

untitled

Microsoft PowerPoint - C_Programming(3).pptx

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

:30 12:00 I. I VI II. III. IV. a d V. VI

新・明解C言語 実践編

Microsoft Word - COMP-MATH-2017-FULLTEXT.doc

3-4 switch 文 switch 文は 単一の式の値によって実行する内容を決める ( 変える ) 時に用いる 例えば if 文を使って次のようなプログラムを作ったとする /* 3 で割った余りを求める */ #include <stdio.h> main() { int a, b; } pri

PowerPoint プレゼンテーション

3. 標準入出力

kiso2-09.key

fuga scanf("%lf%*c",&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数 scanf( %d%*c,&hoge); キーボードから取り込め という命令 1: scanf 1 1: int double scanf %d %lf printf

K227 Java 2

Prog1_6th


<82D282A982C1746F95F18D908F57967B95B E696E6464>

秋植え花壇の楽しみ方


C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)

プログラミングI 第2回 数理物理,総合理学等向け

#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main

main

gengo1-2

8 if switch for while do while 2

Prog1_15th

新・明解C言語で学ぶアルゴリズムとデータ構造

プログラミング実習I

<4D F736F F D20438CBE8CEA8D758DC F0939A82C282AB2E646F63>

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

Microsoft Word - Cプログラミング演習(1)_2012

PowerPoint Presentation

橡Pro PDF

untitled

2) TA Hercules CAA 5 [6], [7] CAA BOSS [8] 2. C II C. ( 1 ) C. ( 2 ). ( 3 ) 100. ( 4 ) () HTML NFS Hercules ( )

Microsoft Word - no15.docx

2 P.S.P.T. P.S.P.T. wiki 26

C言語入門

新版明解C言語 実践編

cp-7. 配列

(ver. 1.3 (2018) ) yacc 1 1 yacc yacc (Yet Another Compiler Compiler) UNIX yacc yacc y *.y yacc ) yacc *.tab.h *.tab.c C C yacc yacc UNIX yacc bison 2

printf("5つの整数を入力して下さい \n"); /* データ入力 */ for( /*** 02 ***/ ){ printf("%dつ目の入力 :",i+1); scanf("%d", /*** 03 ***/ ); sum=dat[0]; /* 合計値の初期設定 */ n_max= 0

kiso2-06.key


解きながら学ぶC言語

joho09.ppt

Cプログラミング - 第8回 構造体と再帰

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

卒 業 研 究 報 告.PDF

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

Ruby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=>

プログラミング基礎

Microsoft PowerPoint - program.ppt [互換モード]

Microsoft PowerPoint - CproNt02.ppt [互換モード]

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

新・明解C言語 ポインタ完全攻略

導入基礎演習.ppt

LAN Copyright c Daikoku Manabu This tutorial is licensed under a Creative Commons Attribution 2.1 Japan License

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

/* sansu1.c */ #include <stdio.h> main() { int a, b, c; /* a, b, c */ a = 200; b = 1300; /* a 200 */ /* b 200 */ c = a + b; /* a b c */ }

演習課題No12

/*Source.cpp*/ #include<stdio.h> //printf はここでインクルードして初めて使えるようになる // ここで関数 average を定義 3 つの整数の平均値を返す double 型の関数です double average(int a,int b,int c){

21 B92 B92 Quantum cryptography simulator

計算機プログラミング

For_Beginners_CAPL.indd

Microsoft Word - Cプログラミング演習(8)

Transcription:

C (3)

if else switch AND && OR (NOT)!

1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0

1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work

1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work emacs bmi.c &

1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work emacs bmi.c & gcc bmi.c

1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 cd work emacs bmi.c & gcc bmi.c./a.out

1 double Height, Weight, BMI; printf(" ") scanf(" ") scanf("%lf",&height); BMI BMI = 10000*Weight / (Height*Height); BMI printf("%f", BMI);

if if if { }else{ } {} else

if if x>0 printf("x is a positive number Yn"); if (x>0) { printf("x is a positive number Yn"); }

if ==,! =, <, >, <=, >= 1 0 a==b a b 1 a!=b a b 1 a<b a b 1 a>b a b 1 a<=b a b 1 a>=b a b 1 x 10 if (x==10)... = == x 20 if (x>=20)... a*b+c< a/b

if, &&,! a b a b 1 a && b a b 1! a a 0, 1 x 10 20 if (x>=10 && x<20)...

x>=3 && x<5 x 3 x 5 x>=3 x<5 x 3 x 5!(x==3) x 3 x!=3!(x==0 y==0) x!=0 && y!=0 1 2 ( )! <, >, <=, >= ==,!= &&!!

if 1 #include <stdio.h> int main(void){ double Score = 85; if( Score<80) printf("your grade is BYn"); if(80<=score && Score<90) printf("your grade is AYn"); if(90<=score ) printf("your grade is A++Yn"); } return 0; Score Your grade is B Your grade is A Your grade is A++ &&

if 2 #include <stdio.h> int main(void){ double Score = 85; if(score < 80) printf("your grade is BYn"); else if(score < 90) printf("your grade is AYn"); else printf("your grade is A++Yn"); return 0; } if Yes Your grade is B No Yes Your grade is A No Your grade is A++

if 3 if(score< 70){ if(score< 60) printf("your grade is DYn"); else printf("your grade is CYn"); }else{ if(score< 80) printf("your grade is BYn"); else{ if(score< 90) printf("your grade is AYn"); else printf("your grade is A++Yn"); } } Yes Yes Your grade is D No Your grade is C Yes Your grade is B No No Yes Your grade is A No Your grade is A++

2 BMI WHO WHO bmi2.c BMI WHO 18.5 Underweight 18.5 25.0 Normal 25.0 30.0 Pre-obese 30.0 Obese class Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. Normal.

switch switch switch ( ){ case : ; break; case : ; break; case : ; break; default: ; break; }

switch case default default break; default break;

switch #include <stdio.h> int main(void){ int num; scanf("%d", &num); printf("%d is divisible by 3 with",num); switch (num % 3){ case 1 : printf("remainder 1Yn"); break; case 2 : printf("remainder 2Yn"); break; default: printf("remainder 0Yn"); break; } return 0; } num % 3

1 ( ) ( ) [ ] ->. 2!, + -, ++, &, *, sizeof 3 * / 4 5 << >> 6 < > <= >= 7 ==!= 8 AND & 9 XOR ^ 10 OR 11 AND && 12 OR 13?: 14 = *=, /=, %=, +=, -=, &=, ^=, = 15,

if else switch AND && OR (NOT)!