新版明解C言語入門編
|
|
- ほのか ひろもり
- 5 years ago
- Views:
Transcription
1 175cm 60kg ( ) 175cm 175.3cm cm 175cm 60kg
2 p 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 = %d\n", vx + vy); printf("vx - vy = %d\n", vx - vy); printf("vx * vy = %d\n", vx * vy); printf("vx / vy = %d\n", vx / vy); printf("vx %% vy = %d\n", vx % vy); vx 57 vy 1 vx + vy = 78 vx - vy = 36 vx * vy = 1197 vx / vy = vx % vy = 15 vxvy vx - vy 3 p.49 * operator operand vx + vy + vx vy
3 -1 19 / / 5 / / 5 0 % 5 % 3 3 % 5 3 Table -1 multiplicative operatortable - additive operator Table -1 * a * b a b / a / b a b % a % b a ba b Table - + a + b a b - a - b a b binary * operator / operator % operator binary + operator binary - operator printf % printf("vx %% vy = %d\n", vx % vy); % %d % % %% puts %% %% Column -1
4 0 List - List - int no; printf(""); scanf("%d", &no); printf(" %d\n", no % 10); ( ) ( ) Column -1 % % % % % %
5 -1 1 List -3 List -3 int na, nb; puts(""); printf(""); scanf("%d", &na); printf(""); scanf("%d", &nb); printf("%d%d\n", na / nb, na % nb); %dfig.-1 printf(" %d %d \n", na / nb, na % nb ) 15 Fig.-1 printf
6 List -4 List -4 int num; printf(""); scanf("%d", &num); ( ) ( ) printf(" %d\n", -num); - - unary - operator - + unary + operator Table a a - -a a Table !p.61 ~ p.164 unary arithmetic operator
7 6 p Table -4 assignment operator = 4 = simple assignment operator Table -4 a = b b a expression vx + 3 vx, 3, vx + 3 vc = vx + 3 vc, vx, 3, vx + 3, vc = vx + 3 vc = vx + 3 assignment expression p.5 ; vc = vx + 3; expression statement if while
8 p List -5 List -5 int na, nb; puts(""); printf(""); scanf("%d", &na); printf(""); scanf("%d", &nb); printf("%d\n", (na + nb) / ); na + nb () na + nb / na nb / 4.54 int type
9 "%f" f floating-point 6-5 int double floating-point number double int double List -6 List -6 int nx; double dx; int nx 9 nx / 4 double dx dx/ nx = 9.99; dx = 9.99; printf(" int nx%d\n", nx); 9 printf(" nx / %d\n", nx / ); 9 / printf("double dx%f\n", dx); 9.99 printf(" dx/.0 %f\n", dx /.0); 9.99 /.0 nx int dx double 9.99 Fig.-int nx 9 nx / 9 / / p.19 printf double "%d" "%f" p.3 nx int dx double Fig.-
10 -3,767 3,767 p Fig.-3 int double nxdx int nx ; int nx double dx ; double dx Fig.-3 int double 7 int object
11 integer constant 3.14 floating constant int double 7 double List -7 List -7 double vx, vy; puts(" "); printf(" vx "); scanf("%lf", &vx); printf(" vy "); scanf("%lf", &vy); printf("vx + vy = %f\n", vx + vy); printf("vx - vy = %f\n", vx - vy); printf("vx * vy = %f\n", vx * vy); printf("vx / vy = %f\n", vx / vy); vx 40.5 vy 5. vx + vy = vx - vy = vx * vy = vx / vy = Table -5 double scanf "%lf" Table -5 int double printf printf("%d", no) printf("%f", no) scanf scanf("%d", &no) scanf("%lf", &no)
12 % 8 / Fig.-4 int / int double / double int / double double / int int double int double " " double double + * 5 / 5.0 /.0.5 int / int int double / double double 5.0 / 5 /.0 double / int int / double 5.0 / /.0.5 double / double double double / double double Fig.-4 p.179 double int
13 - 9 List -8 List -8 int n1, n, n3, n4; double d1, d, d3, d4; n1 = 5 / ; n1 n = 5.0 /.0; n.5 n3 = 5.0 / ; n3.5 n4 = 5 /.0; n4.5 d1 = 5 / ; d1 d = 5.0 /.0; d.5 d3 = 5.0 / ; d3.5 d4 = 5 /.0; d4.5 printf("n1 = %d\n", n1); printf("n = %d\n", n); printf("n3 = %d\n", n3); printf("n4 = %d\n\n", n4); printf("d1 = %f\n", d1); printf("d = %f\n", d); printf("d3 = %f\n", d3); printf("d4 = %f\n", d4); n1 = n = n3 = n4 = d1 = d = d3 = d4 = int n1 n, n3, n4.5 double d1 d, d3, d4.5 p.17-4 int double
14 30 List -5 List -9 List -9 int na, nb; puts(""); printf(""); scanf("%d", &na); printf(""); scanf("%d", &nb); printf("%f\n", (na + nb) /.0); ( na + nb ) /.0 ( ) int + int + int ( ) /.0 /.0 List -10
15 - 31 List -10 int na, nb; puts(""); printf(""); scanf("%d", &na); printf(""); scanf("%d", &nb); printf("%f\n", (double)(na + nb) / ); ( ) cast ( ) cast operatortable -6 Table -6 ( ) a a (double)(na + nb) na + nb double (na + nb)double /
16 3 List -11 List -11 int na, nb, nc; int sum; double ave; puts(""); printf(""); scanf("%d", &na); printf(""); scanf("%d", &nb); printf(""); scanf("%d", &nc); sum = na + nb + nc; ave = (double)sum / 3; printf("%5d\n", sum); printf("%5.1f\n", ave); printf %5d %5.1f %5d 10 5 %5.1f 5 1 %09.9f List -1 (a) 0 0 (b) -
17 - 33 List -1 printf("[%d]\n", 13); printf("[%.4d]\n", 13); printf("[%4d]\n", 13); printf("[%04d]\n", 13); printf("[%-4d]\n\n", 13); printf("[%d]\n", 1345); printf("[%.3d]\n", 1345); printf("[%3d]\n", 1345); printf("[%03d]\n", 1345); printf("[%-3d]\n\n", 1345); printf("[%f]\n", 13.13); printf("[%.1f]\n", 13.13); printf("[%6.1f]\n\n", 13.13); printf("[%f]\n", 13.13); printf("[%.1f]\n", 13.13); printf("[%4.1f]\n\n", 13.13); [13] [013] [ 13] [013] [13 ] [1345] [1345] [1345] [1345] [1345] [ ] [13.1] [ 13.1] [ ] [13.1] [13.1] (c) 1 6 (d) d int 10 f double 10 printf p
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 informationMicrosoft PowerPoint - 説明2_演算と型(C_guide2)【2015新教材対応確認済み】.pptx
情報ネットワーク導入ユニット Ⅰ C 言語 演算と型 演算 代入 演算と型 +,-,*,/,% = C 言語では 代入 の意味 vx = a + b; //a+b の結果を vx に代入 型 : int 型 ( 整数 ) double 型 ( 実数 ) 演算での型変換 ( 整数, 実数の混在 ) キャスト演算子 型を一時的に変更 書式指定 :printf("%6d n", a); 加減, 剰余演算
More information新・明解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 informationC言語によるアルゴリズムとデータ構造
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 informationmain
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 informationP06.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 informationP03.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新版 明解C++入門編
第 1 章画面 出力 入力 C++ C++ C++ C++ C++ C++ C++ C++ #include using C++ C++ C++ main C++ C++ C++ int double char C++ C++ C++ string C++ C++ C++ 21 1-1 C++ 歴史 C++ C++ 歴史 CC with classes Fig.1-1 C C++ Simula 67
More information解きながら学ぶ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 information18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o
18 C ( ) 1 1 1.1 hello world.c 5 printf("hello World\n"); 6 } [ ] [ ] #include % cc hello_world.c %./a.out Hello World [a.out ] % cc hello_world.c -o hello_world [ ( ) ] (K&R 4.1.1) #include
More informationPowerPoint 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新・明解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 informationC¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç
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
More information新版明解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 informationMicrosoft PowerPoint - 説柔5_間勊+C_guide5ï¼›2015ã•’2015æŒ°æŁŽæš’å¯¾å¿œç¢ºèª“æ¸‹ã†¿ã•‚.pptx
情報ネットワーク導入ユニット Ⅰ C 言語 配列 5 章 : 配列同じ型 (int, double など ) の変数の集まりを 番号 ( 添字 ) で管理する変数 int vc[5]; // 要素数が 5 の配列 vc[0] = 1; vc[1] = 2; vc[2] = 3; vc[3] = 4; vc[4] = 5; printf("vc[0] = %d n", vc[0] ); printf("vc[1]
More informationMicrosoft 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 informationgengo1-2
変数 プログラム中で 値を格納するには変数 variable を用いる変数は 格納する値の型によって 整数型 文字型 などの型 type をもつ変数を使うには 利用に先立って変数の宣言 declaration をしなければならない 値 変数の値はコンピュータのメモリ上に格納される 具体的にメモリのどの場所に格納されるかは言語処理系が自動的に扱うので プログラマ ( 特に初級者 ) が意識する必要はない
More informationgengo1-11
関数の再帰定義 自然数 n の階乗 n! を計算する関数を定義してみる 引数は整数 返却値も整数 n! = 1*2*3*... * (n 1)*n である ただし 0! = 1 とする int factorial(int n) int i, tmp=1; if( n>0 ) for(i=1; i
More informationkiso2-09.key
座席指定はありません 計算機基礎実習II 2018 のウェブページか 第9回 ら 以下の課題に自力で取り組んで下さい 計算機基礎実習II 第7回の復習課題(rev07) 第9回の基本課題(base09) 第8回試験の結果 中間試験に関するコメント コンパイルできない不完全なプログラムなど プログラミングに慣れていない あるいは複雑な問題は 要件 をバラして段階的にプログラムを作成する exam08-2.c
More information17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include<stdio
17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include typedef struct Potter{ Potter; int main(void){
More informationVol.55 No (Jan. 2014) De-gapper 1,a) 2, , De-gapper De-gapper De-gapper Tool for Support Programming Learners Step-b
De-gapper 1,a) 2,3 4 3 2013 3 18, 2013 10 9 1 De-gapper De-gapper De-gapper Tool for Support Programming Learners Step-by-step Learning Shinya Cho 1,a) Yayoi Hofuku 2,3 Tomohiro Nishida 4 Susumu Kanemune
More information: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology
I117 8 1 School of Information Science, Japan Advanced Institute of Science and Technology : CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and
More information<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 information180 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 information6 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明解Javaによるアルゴリズムとデータ構造
21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java
More informationkiso2-06.key
座席指定があります Linux を起動して下さい 第6回 計算機基礎実習II 計算機基礎実習II 2018 のウェブページか ら 以下の課題に自力で取り組んで下さい 第5回の復習課題(rev05) 第6回の基本課題(base06) 第5回課題の回答例 ex05-2.c 1. キーボードから整数値 a を入力すると a*a*a の値を出力することを繰り返すプログラムを作成しなさい 2. ただし 入力された
More informationchar int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く
変数 入出力 演算子ここまでに C 言語プログラミングの様子を知ってもらうため printf 文 変数 scanf 文 if 文を使った簡単なプログラムを紹介した 今回は変数の詳細について習い それに併せて使い方が増える入出力処理の方法を習う また 演算子についての復習と供に新しい演算子を紹介する 変数の宣言プログラムでデータを取り扱う場合には対象となるデータを保存する必要がでてくる このデータを保存する場所のことを
More information[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 informationtuat1.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 informationC による数値計算法入門 ( 第 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‚æ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£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (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 information16soukatsu_p1_40.ai
2 2016 DATA. 01 3 DATA. 02 4 DATA. 03 5 DATA. 04 6 DATA. 05 7 DATA. 06 8 DATA. 07 9 DATA. 08 DATA. 09 DATA. 10 DATA. 11 DATA. 12 DATA. 13 DATA. 14 10 11 12 13 COLUMN 1416 17 18 19 DATA. 15 20 DATA. 16
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 の Point を用いて 2 点の座標を入力するとその 2 点間の距 離を表示するプログラムを作成せよ 平方根は
More informationA/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 informationex14.dvi
1,, 0, b (b b 2 b ) n k n = n j b j, (0 n j b 1), n =(n k n k 1...n 1 n 0 ) b, n j j j +1, 0,...,b 1 (digit). b b, n b 1 ñ, ñ = k (b 1 n j )b j b N, n b n, n = b N n, n =ñ+1 b N, n m n + m (mod b N ),
More informationMicrosoft 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 information2004
2008 3 20 400 1 1,222 7 1 2 3 55.8 54.8 3 35.8 6 64.0 50.5 93.5 1 1,222 1 1,428 1 1,077 6 64.0 52.5 80.5 56.6 81.5 30.2 1 2 3 7 70.5 1 65.6 2 61.3 3 51.1 1 54.0 2 49.8 3 32.0 68.8 37.0 34.3 2008 3 2 93.5
More informationMicrosoft PowerPoint - program.ppt [互換モード]
プログラミング演習 バージョン 1 担当教員 : 綴木馴 プログラムの決まりについて学ぶ おすすめする参考書 ザ C 戸川隼人サイエンス社 本日の予定 1. 授業の説明. 2. コンパイラーのインストール. プログラムの決まりについて学ぶ,P31 /* The most in C */ /* hello.c */ printf("hello,world n"); プログラムの決まり ( コメント )
More information3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<
C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello
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
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言語 実践編
第 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 informationMicrosoft Word - no14.docx
ex26.c #define MAX 20 int max(int n, int x[]); int num[max]; int i, x; printf(" "); scanf("%d", &x); if(x > MAX) printf("%d %d \n", MAX, MAX); x = MAX; for(i = 0; i < x; i++) printf("%3d : ", i + 1); scanf("%d",
More informationuntitled
II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*
More informationI 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新・明解Javaで学ぶアルゴリズムとデータ構造
第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");
More informationプログラミング実習I
プログラミング実習 I 03 変数と式 人間システム工学科井村誠孝 m.imura@kwansei.ac.jp 3.1 変数と型 変数とは p.60 C 言語のプログラム中で, 入力あるいは計算された数や文字を保持するには, 変数を使用する. 名前がついていて値を入れられる箱, というイメージ. 変数定義 : 変数は変数定義 ( 宣言 ) してからでないと使うことはできない. 代入 : 変数には値を代入できる.
More information明解Java入門編
1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");
More informationC言語7
C 言語 7 ポインタ アドレスを出力 int a; a=5; printf(" 変数 aの値は %dです n", a); printf(" 変数 aのアドレスは %pです n", &a); 実行結果 変数 a の値は 5 です 変数 a のアドレスは 0038FAC4 です 変数 a の値は 15 です 変数 a のアドレスは 0038FAC4 です 注 アドレスの値は実行環境やプログラムの実行状況により異なります
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 informationMicrosoft Word - Cプログラミング演習(7)
第 7 回 (6/4) 2. 構造体 構造体とは, 同じ型に限定されない複数の関連するデータメンバの集合である 構造体の宣言構造体指定子 struct を用いて struct 構造体タグ名 { メンバ 1 の宣言 ; メンバ 2 の宣言 ; メンバ n の宣言 ; }; 注 ) 構造体タグ名は構造体の型名で, 内容を定義するものでオブジェクトではなく, 論理的なテンプレートである 構造体の変数の宣言実際の記憶領域を占める物理的実体を確保する
More information演算増幅器
構造体 ここまでに char int doulbe などの基本的なデータ型に加えて 同じデータ型が連続している 配列についてのデータ構造について習った これ以外にも もっと複雑なデータ型をユーザが定義 することが可能である それが構造体と呼ばれるもので 異なる型のデータをひとかたまりのデー タとして扱うことができる 異なるデータをまとめて扱いたい時とはどんな場合だろうか 例えば 住民データを管理したい
More informationcp-7. 配列
cp-7. 配列 (C プログラムの書き方を, パソコン演習で学ぶシリーズ ) https://www.kkaneko.jp/cc/adp/index.html 金子邦彦 1 本日の内容 例題 1. 月の日数配列とは. 配列の宣言. 配列の添え字. 例題 2. ベクトルの内積例題 3. 合計点と平均点例題 4. 棒グラフを描く配列と繰り返し計算の関係例題 5. 行列の和 2 次元配列 2 今日の到達目標
More informationuntitled
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初歩の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 informationMicrosoft 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 informationmain.dvi
1 F77 5 hmogi-2008f@kiban.civil.saitama-u.ac.jp 2013/5/13 1 2 f77... f77.exe f77.exe CDROM (CDROM D D: setupond E E: setupone 5 C:work\T66160\20130422>f77 menseki.f -o menseki f77(.exe) f77 f77(.exe) C:work\T66160\20130422>set
More information1. 52
51 1. 52 5 2. 1 2 54 4 55 5 1 56 2 57 . 1 1 58 2 1 59 2 4 60 61 62 6 64 4. 65 66 67 5 1 2 4 68 1 69 2 70 1 2 71 72 1 2 7 1 2 74 75 1 76 2 77 1 2 78 4 79 5 80 6. 1 81 2 82 8 84 85 86 87 7. 88 89 8. column
More information1 2 2 36 8 1212 15 16 20 22 24 26 28 8 14 21 1 31 32 32 3335 37 39 43 45 48 49 5051 54 56 58 6264 6669 43 50 58 2 73 74 7779 8183 85 88 91 93 9698 100 102103 74 85 93 106 106 108 110 112 3 115 116 116
More informationMicrosoft PowerPoint - lec4.ppt
本日の内容 繰り返し計算 while 文, for 文 例題 1. 最大公約数の計算例題 2. 自然数の和 while 文例題 3. フィボナッチ数列例題 4. 自然数の和 for 文例題 5. 九九の表繰り返しの入れ子 今日の到達目標 繰り返し (while 文, for 文 ) を使って, 繰り返し計算を行えるようになること ループカウンタとして, 整数の変数を使うこと 今回も, 見やすいプログラムを書くために,
More information2 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 informationII 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y
II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word
More information£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –
(2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001
More information1 4 2 EP) (EP) (EP)
2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)
More information<4D F736F F D20438CBE8CEA8D758DC03389F0939A82C282AB2E646F63>
C 言語講座第 3 回 キャスト ( 型変換 ) 強制的に式の型を変換する ( 変換したい型名 ) 変換元で記述する int num_a = 10, num_b = 3; float result1, result2; // 結果格納用 // 計算用 result1 = num_a / num_b; // 通常のint/int 割り算 result2 = (float)num_a / num_b;//
More information橡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 informationC 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 informationA/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 informationMicrosoft PowerPoint - å®�æ−•è©¦é¨fi3ㆮ対ç�Œ.pptx
C言語の繰り返し処理 for文と while文と do文 臼杵 潤 0) 準備 変数の加減算 int a, b=10; // a= a = 0; a = a+1; // a= a += 1; // a= // a= a ++; a = a + b; // a= a += b; // a= // a= a --; 下を1行ずつ実行すると それぞれ aの値はどう変わるか 0 1 2 3 13 23 22
More information無印良品のスキンケア
2 3 4 5 P.22 P.10 P.18 P.14 P.24 Na 6 7 P.10 P.22 P.14 P.18 P.24 8 9 1701172 1,400 1701189 1,000 1081267 1,600 1701257 2,600 1125923 450 1081250 1,800 1125916 650 1081144 1,800 1081229 1,500 Na 1701240
More informationPC 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#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 informationfuga 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£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (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 informationII ( ) 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/*Source.cpp*/ #include<stdio.h> //printf はここでインクルードして初めて使えるようになる // ここで関数 average を定義 3 つの整数の平均値を返す double 型の関数です double average(int a,int b,int c){
ソフトゼミ A 第 6 回 関数 プログラムは関数の組み合わせでできています 今までのゼミAでも printf や scanf など様々な関数を使ってきましたが なんと関数は自分で作ることもできるのです!! 今日は自作関数を中心に扱っていきます ゲーム制作でも自作関数は避けては通れないので頑張りましょう そもそもまず 関数とは 基本的には 受け取った値に関数によって定められた操作をして その結果の値を返す
More informationcompiler-text.dvi
2018.4 1 2 2.1 1 1 1 1: 1. (source program) 2. (object code) 3. 1 2.2 C if while return C input() output() fun var ( ) main() C (C-Prime) C A B C 2.3 Pascal P 1 C LDC load constant LOD load STR store AOP
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 */ }
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 informationohp1.dvi
2008 1 2008.10.10 1 ( 2 ) ( ) ( ) 1 2 1.5 3 2 ( ) 50:50 Ruby ( ) Ruby http://www.ruby-lang.org/ja/ Windows Windows 3 Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is08/ / ( / ) / @@@ ( 3 ) @@@ :!! ( )
More informationuntitled
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付録PDF.indd
Appendix 特別付録 特 1 特 2 本書で扱った主な関数の使い方 解答解答解答解答 付録 A 補足 392 ページ 3 プログラムコードの記述と保存 の 1 の手順のようにプログラムコー ドを入力できる状態にするには 先に以下の手順を行ってください Appendix 特 1 1 章整数による簡単な計算 1 Visual C++ 2008 Express E d i t i o n を起動して
More informationjoho12.ppt
n φ 1 (x),φ 2 (x),,φ n (x) (x i, f i ) Q n c 1,,c n (,f k ) q n = c i φ i (x) x Q n i=1 c 1 = 0 c 1 n ( c 1 ) = q n f k 2 Q n ( c 1 ) = q 2 2 n ( ) 2 f k q n ( ) + f k Q n c 1 = c 1 q n 2 q n( ) q n q
More informationA 30 A A ( ) 2 C C (, machine language) C (C compiler) ( ) Mac Apple Xcode Clan
C 2017 9 29, 30 5 13 http://nalab.mind.meiji.ac.jp/~mk/labo/text/ 1 2 2 C 2 3 4 3.1 C................................... 4 3.2 Hello world........................................ 5 3.3 5...............................
More informationp01.qxd
2 s 1 1 2 6 2 POINT 23 23 32 15 3 4 s 1 3 2 4 6 2 7003800 1600 1200 45 5 3 11 POINT 2 7003800 7 11 7003800 8 12 9 10 POINT 2003 5 s 45700 3800 5 6 s3 1 POINT POINT 45 2700 3800 7 s 5 8 s3 1 POINT POINT
More information