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

Size: px
Start display at page:

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

Transcription

1 C (3)

2 if else switch AND && OR (NOT)!

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

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

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

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

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

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

9 if if if { }else{ } {} else

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

11 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

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

13 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 ( )! <, >, <=, >= ==,!= &&!!

14 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++ &&

15 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++

16 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++

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

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

19 switch case default default break; default break;

20 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

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

22 if else switch AND && OR (NOT)!

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó  ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡ (2018) 2018 5 17 0 0 if switch if if ( ) if ( 0) if ( ) if ( 0) if ( ) (0) if ( 0) if ( ) (0) ( ) ; if else if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 (0) 2 if else

More information

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

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx 情報ネットワーク導入ユニット Ⅰ C 言語 if 文 switch 文 3 章 : プログラムの流れの分岐 if 文 if( 条件 ) 条件が成立すれば実行 if( 条件 ) ~ else 場合分け ( 成立, 不成立 ) if( 条件 A) ~ else if( 条件 B) ~ else if( 条件 C) ~ else 場合分け ( 複数の条件での場合分け ) 等価演算子 : == ( 等しい

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

P03.ppt

P03.ppt (2) Switch case 5 1 1 2 1 list0317.c if /*/ intnum; printf(""); scanf("%d", &num); 2 if (num % 3 == 0) puts( 0"); else if (num % 3 == 1) puts(" 1"); else puts( 32"); 3 if list0318.c /*/ intnum; printf("");

More information

P05.ppt

P05.ppt 2 1 list0415.c forfor #include int i, j; for (i = 1; i

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅰ 条件分岐 if~else if~else 文,switch 文 条件分岐 if~else if~else 文 if~else if~else 文 複数の条件で処理を分ける if~else if~else 文の書式 if( 条件式 1){ 文 1-1; 文 1-2; else if( 条件式 2){ 文 2-1; 文 2-2; else { 文 3-1; 文 3-2; 真条件式

More information

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

8 / 0 1 i++ i 1 i-- i C !!! C 2 C 2006 5 2 printf() 1 [1] 5 8 C 5 ( ) 6 (auto) (static) 7 (=) 1 8 / 0 1 i++ i 1 i-- i 1 2 2.1 C 4 5 3 13!!! C 2 2.2 C ( ) 4 1 HTML はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga

More information

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

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

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

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

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

初歩のC言語ターミナル_2014_May.pages C Mac OS X ( Vi Mi) Xcode CD >cd C:\Users\\Desktop gcc first.c C:\Users\\Desktop>gcc -o first first.c gcc first.c C:\Users\\Desktop>first Windows OS VisualStudio VisualStudio VS2012 CD C:\ >cd C:\Users\

More information

/* 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

/* 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 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

C C UNIX C ( ) 4 1 HTML 1

C C UNIX C ( ) 4 1 HTML 1 C 2007 4 18 C UNIX 1 2 1 1.1 C ( ) 4 1 HTML 1 はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga hoge.c コンパイルにより機械語に変換 コンパイルエラー./fuga 実行 実行時エラー 完成 1: work hooge.c fuga 1 4 4 1 1.

More information

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

char int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く 変数 入出力 演算子ここまでに C 言語プログラミングの様子を知ってもらうため printf 文 変数 scanf 文 if 文を使った簡単なプログラムを紹介した 今回は変数の詳細について習い それに併せて使い方が増える入出力処理の方法を習う また 演算子についての復習と供に新しい演算子を紹介する 変数の宣言プログラムでデータを取り扱う場合には対象となるデータを保存する必要がでてくる このデータを保存する場所のことを

More information

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

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 C++ 1 C C++ C++ C C C++ 1.1 C printf() scanf() C++ C 1-1 #include int a; scanf( "%d", &a ); printf( "a = %d\n", a ); C++ 1-2 int a; std::cin >> a; std::cout

More information

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

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

P02.ppt

P02.ppt int If 2 1 ,,, 3 a + b ab a - b ab a * b ab a / b ab a % b ab a + b 4 2 list0201.c /, % /*/ int vx, vy; puts(""); printf("vx"); scanf("%d", &vx); printf("vy"); scanf("%d", &vy); printf("vx + vy = %d\n",

More information

新版明解C言語入門編

新版明解C言語入門編 175cm 60kg ( ) 175cm 175.3cm 175.869758 cm 175cm 60kg p.177 18-1 vx - vy vx vy List -1 List -1 int vx, vy; puts(""); printf(" vx "); scanf("%d", &vx); printf(" vy "); scanf("%d", &vy); printf("vx + vy

More information

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 >>

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 >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション 2018/10/05 竹島研究室創成課題 第 2 回 C 言語演習 変数と演算 東京工科大学 加納徹 前回の復習 Hello, world! と表示するプログラム 1 #include 2 3 int main(void) { 4 printf("hello, world! n"); 5 return 0; 6 } 2 プログラム実行の流れ 1. 作業ディレクトリへの移動 $ cd

More information

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

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B A/B (2010/10/08) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2010/soft/soft.html 2010 10 8 A/B 1 2010 10 8 2 1 1 1.1 OHP.................................... 1 1.2.......................................

More information

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

プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; } Point; 問題 18. 問題 17 の プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; Point; 問題 18. 問題 17 の Point を用いて 2 点の座標を入力するとその 2 点間の距 離を表示するプログラムを作成せよ 平方根は

More information

P06.ppt

P06.ppt p.130 p.198 p.208 2 1 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i < NUM; i++ ) if ( weight[i] > max ) max = weight[i]: if ( weight[i] < min ) min = weight[i]: weight 3 maxof(a,

More information

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

Microsoft PowerPoint - 説明2_演算と型(C_guide2)【2015新教材対応確認済み】.pptx 情報ネットワーク導入ユニット Ⅰ C 言語 演算と型 演算 代入 演算と型 +,-,*,/,% = C 言語では 代入 の意味 vx = a + b; //a+b の結果を vx に代入 型 : int 型 ( 整数 ) double 型 ( 実数 ) 演算での型変換 ( 整数, 実数の混在 ) キャスト演算子 型を一時的に変更 書式指定 :printf("%6d n", a); 加減, 剰余演算

More information

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

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

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

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード] if 文 (a と b の大きい方を表示 ) C 言語 Ⅰ の復習 条件判定 (if, 条件式 ) ループ (for[ 二重まで ], while, do) 配列 ( 次元 次元 ) トレース int a, b; printf( 整数 a: ); scanf( %d, &a); printf( 整数 b: ); scanf( %d, &b); //つのif 文で表現する場合間違えやすい どっちに =

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅰ 条件分岐 : if 文, if~else 文 条件分岐 条件分岐とは ある条件が成立したときとしないときで処理の内容を変更する場合に応じた, 複雑な処理を行うことができる 条件分岐 yes 成績が良かったか? no ご褒美に何か買ってもらう お小遣いが減らされる C 言語では,if 文,if~else 文,if~else if~else 文,switch 文で条件分岐の処理を実現できる

More information

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

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

More information

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

‚æ2›ñ C„¾„ê‡Ìš| I 8 10 10 I ( 6 ) 10 10 1 / 23 1 C ( ) getchar(), gets(), scanf() ( ) putchar(), puts(), printf() 1 getchar(), putchar() 1 I ( 6 ) 10 10 2 / 23 1 (getchar 1 1) 1 #include 2 void main(void){ 3 int

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

Microsoft PowerPoint - class04.ppt

Microsoft PowerPoint - class04.ppt フローチャート フローチャートとは プログラムの処理の流れを整理し 図的に順序立てて描いたもの 流れ図流れ図ともいう 例 : 始め 半径 R 端子 : 開始 終了 停止などを示す 手操作入力 : キーボードなどから手で操作して入力することを示す 面積 S πr 2 処理 : あらゆる種類の処理を示す S 終わり 表示 : ディスプレイ表示を示す このようにフローチャートでは 記号形状自体が処理の意味を示している

More information

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

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 I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT

More information

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

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 II 8 2003 11 12 1 6 ( ) 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 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

Microsoft PowerPoint - C_Programming(3).pptx

Microsoft PowerPoint - C_Programming(3).pptx H23 年度秋学期情報スキル活用 入門 担当 : 田中基彦 ( 工学部共通教育科 ) Email: ak_tanaka@isc.chubu.ac.jp 授業のホームページ学術情報センター > 教育支援 > 情報リテラシー 授業の日程 講義内容提出課題 連絡事項を掲載 > 定期的にアクセスして確認する C 言語によるプログラミング (3) 制御文 繰り返し文 if, while, switch, for,

More information

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

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

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

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

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

Microsoft Word - COMP-MATH-2017-FULLTEXT.doc #2 2017/10/10 5. printf() 解説画面に表示する関数 (= 機能 ) を printf という print は印刷 ( 表示 ) f は format( 書式 ) の意味で プリント-エフと読む どんなプログラムでも 必ず ( といってよい程 ) 使われる関数である 以下を printf.c として秀丸で作製し Visual Studio でコンパイル (cl) し 実行する

More information

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

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

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用 第 15 回 知的情報システム学科張 暁華 プログラミング応用 1 授業のマナー ------ 人の話を聞くときの社会常識 1. 欠席者のかわりに登録を行わない 倫理に反することをやらない あなたの信を問われている蟻の穴から堤防が決壊 2. 私語しないこと : 質問 意見は手を挙げて大きな声ではっきりと意思表示 3. 授業以外のことをしない : 携帯をカバンにいれ イヤホンを使って音楽等を聞かない授業中ゲームを遊ばない

More information

3. 標準入出力

3. 標準入出力 Linux にログインして待っていること以下のサイトを開いておくこと http://www-it.sci.waseda.ac.jp/teachers/w483692/cpr1/ 4. 条件分岐 制御構文 (1) C プログラミング入門基幹 2 ( 月 4) 制御構造 control flow 逐次実行 o 関数は ブロック内の文を書かれた順に実行する 条件分岐 o 変数などがある条件を満たす場合だけ実行する

More information

kiso2-09.key

kiso2-09.key 座席指定はありません 計算機基礎実習II 2018 のウェブページか 第9回 ら 以下の課題に自力で取り組んで下さい 計算機基礎実習II 第7回の復習課題(rev07) 第9回の基本課題(base09) 第8回試験の結果 中間試験に関するコメント コンパイルできない不完全なプログラムなど プログラミングに慣れていない あるいは複雑な問題は 要件 をバラして段階的にプログラムを作成する exam08-2.c

More information

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

fuga scanf(%lf%*c,&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数 scanf( %d%*c,&hoge); キーボードから取り込め という命令 1: scanf 1 1: int double scanf %d %lf printf C 2007 5 16 9 1 9 9 if else for 2 hoge scanf("%d%*c",&hoge); ( 1 ) scanf 1 %d 10 2 %*c (p.337) [Enter] &hoge hoge 1 2 10 decimal number d 1 fuga scanf("%lf%*c",&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

Prog1_6th

Prog1_6th 2012 年 5 月 24 日 ( 木 ) 実施 多分岐のプログラム 前回は多段階の 2 分岐を組み合わせて 3 種類以上の場合分けを実現したが, 式の値の評価によって, 一度に多種類の場合分けを行う多分岐の利用によって見通しのよいプログラムを作成できる場合がある ( 流れ図は右図 ) 式の評価 : 値 1 : 値 2 : 値 n : 該当値無し 処理 1 処理 2 処理 n 既定の処理 switch

More information

6 12 10661 93100 227213202 222208197 85kg cm 20 64.521 106856142 2 1 4 3 9767 100 35 cm 7747 208198 90kg 23 5828 10661 93100 cm 227213202 10639 61 64.521 85kg 78kg 70kg 61 100 197204.5 cm 15 61

More information

<82D282A982C1746F95F18D908F57967B95B E696E6464>

<82D282A982C1746F95F18D908F57967B95B E696E6464> 1 2 (90cm 70cm 2015) 3 (68cm 28cm 30cm 12kg 2015) (77.5 109.5cm 2015) 4 (22cm 50cm 50cm 4.6kg 2015) (45cm 62.5cm 2015) (47.4cm 62.5cm 2014) 5 (28.5cm 23.5cm) (45cm 62cm 2015) (97cm 107cm 2015) 6 7 8 9

More information

180 140 22

180 140 22 21 180 140 22 23 25 50 1 3 350 140 500cm 600 140 24 25 26 27 28 29 30 31 1/12 8.3 1/15 6.7 10 1/8 12.5 1/20 140 90 75 150 60 150 10 30 15 35 2,000 30 32 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 % 100 50 33.3

More information

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

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 C 1 / 21 C 2005 A * 1 2 1.1......................................... 2 1.2 *.......................................... 3 2 4 2.1.............................................. 4 2.2..............................................

More information

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)

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) E-mail: takio-kurita@aist.go.jp 1 ( ) CPU ( ) 2 1. a f(a) =(a 1.0) 2 (1) a ( ) 1(a) f(a) a (1) a f(a) a =2(a 1.0) (2) 2 0 a f(a) a =2(a 1.0) = 0 (3) 1 9 8 7 (x-1.0)*(x-1.0) 6 4 2.0*(x-1.0) 6 2 5 4 0 3-2

More information

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

プログラミングI 第2回 数理物理,総合理学等向け http://www0.info.kanagawa-u.ac.jp/~kaiya/p1/ dotcampus ショートコード 221137 プログラミング I 第 2 回数理物理, 総合理学等向け 2017 年 10 月 2 日 海谷治彦 1 目次 第 2 章 ( レ ) 2 章 ( 明 ) 数値の計算 と 3 章 ( レ ) 1-2 章 ( 明 ) 変数 の内容となります. 整数における加減乗除の計算

More information

#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

#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 =1= (.5, 1.65), (1., 2.72), (2., 7.39).2,.4,.6,.8, 1., 1.2, 1.4, 1.6 1 1: x.2 1.4128.4 1.5372.6 1.796533.8 2.198 1.2 3.384133 1.4 4.1832 1.6 5.1172 8 7 6 5 y 4 3 2 1.5 1 1.5 2 x 1: /* */ #include

More information

main

main 14 1. 12 5 main 1.23 3 1.230000 3 1.860867 1 2. 1988 1925 1911 1867 void JPcalendar(int x) 1987 1 64 1 1 1 while(1) Ctrl C void JPcalendar(int x){ if (x > 1988) printf(" %d %d \n", x, x-1988); else if(x

More information

gengo1-2

gengo1-2 変数 プログラム中で 値を格納するには変数 variable を用いる変数は 格納する値の型によって 整数型 文字型 などの型 type をもつ変数を使うには 利用に先立って変数の宣言 declaration をしなければならない 値 変数の値はコンピュータのメモリ上に格納される 具体的にメモリのどの場所に格納されるかは言語処理系が自動的に扱うので プログラマ ( 特に初級者 ) が意識する必要はない

More information

8 if switch for while do while 2

8 if switch for while do while 2 (Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else

More information

Prog1_15th

Prog1_15th 2012 年 7 月 26 日 ( 木 ) 実施構造体と typedef typedef 宣言によって,struct 構造体タグ名という表記を再定義し, データ型名のように扱うことができる 構文は typedef struct 構造体タグ名 再定義名 ; となり, この場合の構造体変数の宣言は, 再定義名を用いて行うことができる なお, ここでは 構造体タグ名は省略可能である 構造体を指すポインタ

More information

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

新・明解C言語で学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 141 1-1 三値 最大値 algorithm List 1-1 a, b, c max /* */ #include int main(void) { int a, b, c; int max; /* */ List 1-1 printf("\n"); printf("a"); scanf("%d", &a); printf("b"); scanf("%d",

More information

プログラミング実習I

プログラミング実習I プログラミング実習 I 03 変数と式 人間システム工学科井村誠孝 m.imura@kwansei.ac.jp 3.1 変数と型 変数とは p.60 C 言語のプログラム中で, 入力あるいは計算された数や文字を保持するには, 変数を使用する. 名前がついていて値を入れられる箱, というイメージ. 変数定義 : 変数は変数定義 ( 宣言 ) してからでないと使うことはできない. 代入 : 変数には値を代入できる.

More information

<4D F736F F D20438CBE8CEA8D758DC F0939A82C282AB2E646F63>

<4D F736F F D20438CBE8CEA8D758DC F0939A82C282AB2E646F63> C 言語講座第 2 回 作成 : ハルト 前回の復習基本的に main () の中カッコの中にプログラムを書く また 変数 ( int, float ) はC 言語では main() の中カッコの先頭で宣言する 1 画面へ出力 printf() 2 キーボードから入力 scanf() printf / scanf で整数を表示 / 入力 %d 小数を表示 / 入力 %f 3 整数を扱う int 型を使う

More information

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó  ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡ (2018) 2018 5 24 ( ) while ( ) do while ( ); for ( ; ; ) while int i = 0; while (i < 100) { printf("i = %3d\n", i); i++; while int i = 0; i while (i < 100) { printf("i = %3d\n", i); i++; while int i =

More information

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

Microsoft Word - Cプログラミング演習(1)_2012 第 1 回 (4/16) 参考書 : [1] B.W. カーニハン,D.M. リッチー著 : プログラミング言語 C 第 2 版 ANSI 規格準拠, 共立出版, 1989 年. [2] 高橋麻奈著 : やさしい C 第 2 版, ソフトバンククリエイティブ, 2003 年. [3] 柴田望洋著 : 新版明解 C 言語入門編, ソフトバンククリエイティブ, 2004 年. [4] 林晴比古著 : 新

More information

PowerPoint Presentation

PowerPoint Presentation ファイルの入出力 芝浦工業大学情報工学科 青木義満 今回の講義内容 ファイル入出力 ファイルからのデータ読込み ファイルと配列 2 1 ファイルへのデータ書き込み ( 復習 ) ソースファイル名 :fileio1.c データをファイルに書き込み #include int main(void) { ファイルポインタ宣言 int student_id = 100; char name[

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

untitled

untitled Q 8 1 8.1 (C++) C++ cin cout 5 C++ 16 6 p.63 8.3 #include 7 showbase noshowbase showpoint noshowpoint 8.3 uppercase 16 nouppercase 16 setfill(int) setprecision(int) setw(int) setbase(int) dec

More information

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

2) TA Hercules CAA 5 [6], [7] CAA BOSS [8] 2. C II C. ( 1 ) C. ( 2 ). ( 3 ) 100. ( 4 ) () HTML NFS Hercules ( ) 1,a) 2 4 WC C WC C Grading Student programs for visualizing progress in classroom Naito Hiroshi 1,a) Saito Takashi 2 Abstract: To grade student programs in Computer-Aided Assessment system, we propose

More information

Microsoft Word - no15.docx

Microsoft Word - no15.docx ex33.c /* */ #define IDLENGTH 7 /* */ #define MAX 100 /* */ /* */ struct student char idnumber[idlength + 1]; /* */ int math; /* () */ int english; /* () */ int japanese; /* () */ double average; /* */

More information

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

2 P.S.P.T. P.S.P.T. wiki  26 P.S.P.T. C 2011 4 10 2 P.S.P.T. P.S.P.T. wiki p.s.p.t.since1982@gmail.com http://www23.atwiki.jp/pspt 26 3 2 1 C 8 1.1 C................................................ 8 1.1.1...........................................

More information

C言語入門

C言語入門 1 C 言語入門 第 4 週 プログラミング言語 Ⅰ( 実習を含む ), 計算機言語 Ⅰ 計算機言語演習 Ⅰ, 情報処理言語 Ⅰ( 実習を含む ) News Visual Studio Code https://code.visualstudio.com/ 2 Microsoft 製プログラミング用テキストエディタ 2015-04-29 にリリースされたばかりのテキストエディタ Windows 以外にも

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

cp-7. 配列

cp-7. 配列 cp-7. 配列 (C プログラムの書き方を, パソコン演習で学ぶシリーズ ) https://www.kkaneko.jp/cc/adp/index.html 金子邦彦 1 本日の内容 例題 1. 月の日数配列とは. 配列の宣言. 配列の添え字. 例題 2. ベクトルの内積例題 3. 合計点と平均点例題 4. 棒グラフを描く配列と繰り返し計算の関係例題 5. 行列の和 2 次元配列 2 今日の到達目標

More information

(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

(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 (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 yacc yacc lex %token yacc yacc token *.tab.h #define

More information

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

printf(5つの整数を入力して下さい \n); /* データ入力 */ for( /*** 02 ***/ ){ printf(%dつ目の入力 :,i+1); scanf(%d, /*** 03 ***/ ); sum=dat[0]; /* 合計値の初期設定 */ n_max= 0 電子情報競技会ソフトウェア課題 1 Question_1 プロジェクト内のソースプログラムの /*** XX ***/ に適当な語句 式等を入れ プログラムを完成させなさい ここで 同じ番号の /*** XX ***/ には同じ語句 式等が入る /*** XX ***/ の部分以外は書き換えてはならないが 別のソースファイルにてテストしてもかまわない [ プログラムの説明 ] 1. 処理内容 2 桁の整数データ

More information

kiso2-06.key

kiso2-06.key 座席指定があります Linux を起動して下さい 第6回 計算機基礎実習II 計算機基礎実習II 2018 のウェブページか ら 以下の課題に自力で取り組んで下さい 第5回の復習課題(rev05) 第6回の基本課題(base06) 第5回課題の回答例 ex05-2.c 1. キーボードから整数値 a を入力すると a*a*a の値を出力することを繰り返すプログラムを作成しなさい 2. ただし 入力された

More information

- 1 - A B C D E or or D or or d - 2 - A p18 P19 P21-3 - - 4 - B 2001 P21 P18 P19-5 - - 6 - C P21-7 - - 8 - D P21-9 - P16-10 - E - 11 - RT-PCR - 12 - P16-13 - P21-14 - P16-15 - - 16 - - 17 - Yes No Yes

More information

解きながら学ぶC言語

解きながら学ぶC言語 printf 2-5 37 52 537 52 printf("%d\n", 5 + 37); 5370 source program source file.c ex00.c 0 comment %d d 0 decimal -2 -p.6 3-2 5 37 5 37-22 537 537-22 printf("537%d\n", 5-37); function function call ( )argument,

More information

joho09.ppt

joho09.ppt s M B e E s: (+ or -) M: B: (=2) e: E: ax 2 + bx + c = 0 y = ax 2 + bx + c x a, b y +/- [a, b] a, b y (a+b) / 2 1-2 1-3 x 1 A a, b y 1. 2. a, b 3. for Loop (b-a)/ 4. y=a*x*x + b*x + c 5. y==0.0 y (y2)

More information

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

Cプログラミング - 第8回 構造体と再帰 C 8 ( ) C 1 / 30 n! a n+2 = a n+1 + a n ( ) C 2 / 30 #include struct student{ char name[20]; int math; int phys; ; int main(void){ struct student a, b; struct student c={"frank", 90; ( ) C 3 /

More information

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 >=

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 >= II 14 2018 7 26 : : proen@mm.ics.saitama-u.ac.jp 14,, 8 2 12:00 1 O(1) n O(n) O(log n) O(1) 32 : 1G int 4 250 M 2.5 int 21 2 0 100 0 100 #include #define HASHSIZE 100 /* */ #define NOTFOUND 0

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

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

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

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=>

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=> Ruby Ruby 200779 ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( 2+3+4+5+6+7+8+9 ) 44 irb(main):002:0> irb irb(main):001:0> 1+2+3+4 => 10 irb(main):002:0>

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅱ 演習 2-1(a) BMI による判定 文字列, 身長 height(double 型 ), 体重 weight (double 型 ) をメンバとする構造体 Data を定義し, それぞれのメンバの値をキーボードから入力した後, BMI を計算するプログラムを作成しなさい BMI の計算は関数化すること ( ) [ ] [ ] [ ] BMI = 体重 kg 身長 m 身長

More information

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

Microsoft PowerPoint - program.ppt [互換モード] プログラミング演習 バージョン 1 担当教員 : 綴木馴 プログラムの決まりについて学ぶ おすすめする参考書 ザ C 戸川隼人サイエンス社 本日の予定 1. 授業の説明. 2. コンパイラーのインストール. プログラムの決まりについて学ぶ,P31 /* The most in C */ /* hello.c */ printf("hello,world n"); プログラムの決まり ( コメント )

More information

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

Microsoft PowerPoint - CproNt02.ppt [互換モード] 第 2 章 C プログラムの書き方 CPro:02-01 概要 C プログラムの構成要素は関数 ( プログラム = 関数の集まり ) 関数は, ヘッダと本体からなる 使用する関数は, プログラムの先頭 ( 厳密には, 使用場所より前 ) で型宣言 ( プロトタイプ宣言 ) する 関数は仮引数を用いることができる ( なくてもよい ) 関数には戻り値がある ( なくてもよい void 型 ) コメント

More information

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)* (

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)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

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

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

導入基礎演習.ppt

導入基礎演習.ppt Multi-paradigm Programming Functional Programming Scheme Haskell ML Scala X10 KL1 Prolog Declarative Lang. C Procedural Lang. Java C++ Python Object-oriented Programming / (root) bin home lib 08 09

More information

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

LAN Copyright c Daikoku Manabu This tutorial is licensed under a Creative Commons Attribution 2.1 Japan License LAN 2014 3 19 Copyright c 1993 2014 Daikoku Manabu This tutorial is licensed under a Creative Commons Attribution 2.1 Japan License. 1 2 1.1................................... 2 1.2.........................

More information

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

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t 7 8, /3/, 5// http://nalab.mind.meiji.ac.jp/~mk/labo/text/furiko/ l (, simple pendulum) m g mlθ (t) = mg sin θ(t) () θ (t) + ω sin θ(t) =, ω := ( m ) ( θ ) sin θ θ θ (t) + ω θ(t) = ( ) ( ) g l θ(t) = C

More information

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

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

More information

/* 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 */ }

/* 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 */ } C 2: A Pedestrian Approach to the C Programming Language 2 2-1 2.1........................... 2-1 2.1.1.............................. 2-1 2.1.2......... 2-4 2.1.3..................................... 2-6

More information

演習課題No12

演習課題No12 演習課題 No.12 ( 課題は 3 題ある ) 課題 12-1 時間内提出 従来の C 言語には複素数を直接扱うデータ型はないので (*), 構造体で複素数 ( 英語で complex) を表すことにする. 複素数を表す構造体を以下のように定義する. struct complex float r; // 実部 ( 英語で real) float i; // 虚部 ( 英語で imaginary)

More information

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

/*Source.cpp*/ #include<stdio.h> //printf はここでインクルードして初めて使えるようになる // ここで関数 average を定義 3 つの整数の平均値を返す double 型の関数です double average(int a,int b,int c){ ソフトゼミ A 第 6 回 関数 プログラムは関数の組み合わせでできています 今までのゼミAでも printf や scanf など様々な関数を使ってきましたが なんと関数は自分で作ることもできるのです!! 今日は自作関数を中心に扱っていきます ゲーム制作でも自作関数は避けては通れないので頑張りましょう そもそもまず 関数とは 基本的には 受け取った値に関数によって定められた操作をして その結果の値を返す

More information

21 B92 B92 Quantum cryptography simulator

21 B92 B92 Quantum cryptography simulator 21 B92 B92 Quantum cryptography simulator 1100348 2010 3 1 B92 BB84 BB84 E91 B92 2 3 B92 4 3 5 B92, i Abstract B92 Quantum cryptography simulator Soichiro MATSUMOTO English Nowadays, the public key cryptosystem

More information

計算機プログラミング

計算機プログラミング プログラミング言語 C 第 6 講 制御 ( 選択 ) フローチャートと C 言語 図形と命令の対応表 図形 C 言語 図形 C 言語 START main()? if END? else 整数型変数 int? switch printf case scanf break 選択 (1) if else 文 条件 処理 A 処理 B 構文 if ( 条件 ) IF THEN ELSE 型 処理 A;

More information

For_Beginners_CAPL.indd

For_Beginners_CAPL.indd CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL

More information

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

Microsoft Word - Cプログラミング演習(8) 第 8 回 (6/11) プログラミングスタイルなど [1] 名前のつけかた グローバル変数にはわかりやすい名前を, ローカル変数には短い名前を 関連性のあるものには関連性のある名前をつけて, 統一しよう 関数には能動的な名前を 名前は的確に 例題 1 次のコードの名前と値の選び方についてコメントせよ? #define TRUE 0? #define FALSE 1?? if ((ch = getchar())

More information