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

Size: px
Start display at page:

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

Transcription

1 A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B OHP : printf : scanf : : while kurino/2018/soft/soft.html 2 kurino/2018/soft/ / html 1

2 1 1.1 OHP OHP (HTML) 3 (PDF) Download : sample-001.c 5 1: sample-001.c 2018/10/19 sample-001.c Hello, World.. cc -Ic:\usr\c\include -o sample-001.exe sample-001.c sample-001 main int main( double argc, char argv[] ) printf ( "Hello, World\n" ); Download : sample-002.c 6 2: sample-002.c 3 ohp/html/index.html 4 ohp/ohp.pdf 5 program/sample-001.c 6 program/sample-002.c 1

3 ./sample-001.exe Hello, World 1: sample-001.c 2018/10/19 sample-002.c n^2 cc -Ic:\usr\c\include -o sample-002.exe sample-002.c sample-002 #include "s_input.h" #include "s_print.h" main int main ( int argc, char argv[] ) int n = 13; n=13 n^2 = nn = 1313 = 169 int i = 0; i 0 n-1 int sum = 0; sum odd 0 int odd = 1; odd 1 2 ( ) while ( i < n ) i n sum = sum + odd; sum odd = odd + 2; 2 i = i + 1; s_print_int ( sum ); n^2.. s_print_newline(); 2

4 ./sample-002.exe 169 2: sample-002.c Download : sample-003.c 7 3: sample-003.c 2018/10/19 sample-003.c printf cc -Ic:\usr\c\include -o sample-003.exe sample-003.c sample-003 main int main( int argc, char argv[] ) printf ( "5 + 4 = %d\n", ); %d 9 ( = )./sample-003.exe = 9 3: sample-003.c Download : sample-004.c 8 4: sample-004.c 7 program/sample-003.c 8 program/sample-004.c 3

5 2018/10/19 sample-004.c printf ( ) cc -Ic:\usr\c\include -o sample-004.exe sample-004.c sample-004 main int main( int argc, char argv[] ) printf ( "%d + %d = %d\n", 5, 4, ); %d./sample-004.exe = 9 4: sample-004.c Download : sample-005.c 9 5: sample-005.c 2018/10/19 sample-005.c printf ( ) cc -Ic:\usr\c\include -o sample-005.exe sample-005.c 9 program/sample-005.c 4

6 sample-005 main int main( int argc, char argv[] ) printf ( " %%d %d \n", 123 ); printf ( " %%f %f \n", ); printf ( " %%c %c \n", Z ); printf ( " %%s %s \n", "pqr" );./sample-005.exe %d 123 %f %c Z %s pqr 5: sample-005.c Download : sample-006.c 10 6: sample-006.c 2018/10/19 sample-006.c printf ( ) 10 program/sample-006.c 5

7 cc -Ic:\usr\c\include -o sample-006.exe sample-006.c sample-006 main int main( int argc, char argv[] ) printf ( " \n" ); printf ( "%d, %f, %c, %s\n", 10, 2.3, x, "abc" );./sample-006.exe 10, , x, abc 6: sample-006.c Download : sample-007.c 11 7: sample-007.c 2018/10/19 sample-007.c scanf cc -Ic:\usr\c\include -o sample-007.exe sample-007.c sample-007 main 11 program/sample-007.c 6

8 int main( int argc, char argv[] ) int i; printf ( " : " ); scanf ( "%d", &i ); %d i & ( ) printf ( " %d \n", i ); 123 7:./sample-007.exe < sample-007.in : : sample-007.c Download : sample-008.c 12 8: sample-008.c 2018/10/19 sample-008.c scanf ( ) cc -Ic:\usr\c\include -o sample-008.exe sample-008.c sample program/sample-008.c 7

9 main int main( int argc, char argv[] ) int i; double x; printf ( " : " ); scanf ( "%d", &i ); %d i & ( ) printf ( " %d \n", i ); printf ( " : " ); scanf ( "%lf", &x ); %lf x & ( ) printf ( " %f \n", x ); :./sample-008.exe < sample-008.in : : : sample-008.c Download : sample-009.c program/sample-009.c 8

10 9: sample-009.c 2018/10/19 sample-009.c Enter # A A [ENTER] # [ENTER] cc -Ic:\usr\c\include -o sample-009.exe sample-009.c sample-009 main int main( int argc, char argv[] ) int ch; (int ) ch = getchar(); putchar ( ch ); A 11:./sample-009.exe < sample-009.in A A 12: sample-009.c Download : sample-010.c 14 10: sample-010.c 14 program/sample-010.c 9

11 2018/10/19 sample-010.c cc -Ic:\usr\c\include -o sample-010.exe sample-010.c sample-010 main int main( int argc, char argv[] ) int ch; (int ) ch = getchar(); putchar ( ch ); ch = getchar(); ( [Enter]) putchar ( ch ); A 13:./sample-010.exe < sample-010.in A A 14: sample-010.c Download : sample-011.c 15 11: sample-011.c 15 program/sample-011.c 10

12 2018/10/19 sample-011.c cc -Ic:\usr\c\include -o sample-011.exe sample-011.c sample-011 main int main( int argc, char argv[] ) int ch; ch = getchar(); while ( ch!= EOF ) EOF.. EOF End Of File( ) EOF ( ) ch (int ) EOF.. ch char EOF putchar ( ch ); ch = getchar(); (EOF..) Windows EOF Ctrol-Z ( ^Z : [Ctrl] Z ) ( OS.. ) This is first line. And, it is second line. Last, it is third line. 15: 11

13 ./sample-011.exe < sample-011.in This is first line. This is first line. And, it is second line. And, it is second line. Last, it is third line. Last, it is third line. 16: sample-011.c Download : sample-012.c 16 12: sample-012.c 2018/10/19 sample-012.c fgtec, fputc cc -Ic:\usr\c\include -o sample-012.exe sample-012.c sample-012 main int main( int argc, char argv[] ) int ch; ch = fgetc ( stdin ); stdin ( ) while ( ch!= EOF ) EOF fputc ( ch, stdout ); stdout ( ) ch = fgetc ( stdin ); 16 program/sample-012.c 12

14 This is first line. And, it is second line. Last, it is third line. 17:./sample-012.exe < sample-012.in This is first line. And, it is second line. Last, it is third line. 18: sample-012.c Download : sample-013.c 17 13: sample-013.c 2018/10/19 sample-013.c stdout stderr cc -Ic:\usr\c\include -o sample-013.exe sample-013.c sample-013 main int main( int argc, char argv[] ) printf ( "O: \n" ); printf fprintf ( stderr, "E: \n" ); fprintf stderr fprintf ( stdout, "O: \n" ); fprintf stdout fprintf ( stderr, "E: \n" ); 17 program/sample-013.c 13

15 O: E: O: E: 19: sample-013.c Download : sample-014.c 18 14: sample-014.c 2018/10/19 sample-014.c fopen cc -Ic:\usr\c\include -o sample-014.exe sample-014.c sample-014 main int main( int argc, char argv[] ) FILE ifp; ifp = fopen ( "sample-014.c", "r" ); sample-014.c if ( ifp == NULL ) Open.. fprintf ( stderr, " \n" ); 18 program/sample-014.c 14

16 ( ) else Open int ch; ch = fgetc ( ifp ); fgetc while ( ch!= EOF ) EOF putchar ( ch );.. ch = fgetc ( ifp ); fclose ( ifp ); Download : sample-015.c 19 15: sample-015.c 2018/10/19 sample-015.c fopen cc -Ic:\usr\c\include -o sample-015.exe sample-015.c sample-015 main int main( int argc, char argv[] ) FILE ofp; ofp = fopen ( "sample-015.txt", "w" ); sample-015.txt sample-015.txt if ( ofp == NULL ) Open.. fprintf ( stderr, " \n" ); 19 program/sample-015.c 15

17 ./sample-014.exe 2018/10/19 sample-014.c fopen cc -Ic:\usr\c\include -o sample-014.exe sample-014.c sample-014 main int main( int argc, char argv[] ) FILE ifp; ifp = fopen ( "sample-014.c", "r" ); sample-014.c if ( ifp == NULL ) Open.. fprintf ( stderr, " \n" ); ( ) else Open int ch; ch = fgetc ( ifp ); fgetc while ( ch!= EOF ) EOF putchar ( ch );.. ch = fgetc ( ifp 16 ); fclose ( ifp );

18 ( ) else Open int ch; ch = getchar (); while ( ch!= EOF ) fputc ( ch, ofp );.. ch = getchar (); fclose ( ofp ); sample-015.txt Fist Line Sencod Line Last Line 21:./sample-015.exe < sample-015.in Fist Line Sencod Line Last Line 22: sample-015.c p/ 17

19 1.4 : : printf Download : c 21 16: c CNAME QQQQ.c printf main int main( int argc, char argv[] ) int ia = 7; int ib = 15; double da = 3.14; double db = 1.59; printf ( " o: + o: = o: \n", p:, q:, p: + q: ); printf ( " r: / r: = r: \n", s:, u:, s: / u: ); abc123 23: 21 ex/01/q/01.c 18

20 ./ QQQQ.exe = / = : c : scanf Download : c 22 17: c CNAME QQQQ.c scanf main int main( int argc, char argv[] ) int i; double d; printf ( " : " ); scanf ( " p: ", q: ); printf ( " %d \n", i ); printf ( " : " ); scanf ( " r: ", s: ); printf ( " %f \n", d ); 22 ex/02/q/02.c 19

21 :./ QQQQ.exe : : : c : Download : c 23 18: c CNAME-03 CDATE FILENAME ( a, b, c ) a, b 123, 4 c a b c #include "s_print.h" main int main( int argc, char argv[] ) a int a; b c int c; 23 ex/03/q/03.c 20

22 a 123 a = 123; b 4 c a b c s_print_string ( " c " ); s_print_int ( c ); s_print_string ( " \n" ); :./ QQQQ.exe c : c : while Download : c 24 19: c CNAME-04 CDATE FILENAME 24 ex/04/q/04.c 21

23 while #include "s_print.h" main int main( int argc, char argv[] ) odd ( 1 ) int odd = 1; sum ( 0 ) int sum = 0; sum = = 25 = 5^2 odd 9 while ( q: ) sum odd odd odd = odd + 2; sum s_print_string ( "1 9 " ); s_print_int ( sum ); s_print_string ( " \n" ); : 22

24 ./ QQQQ.exe : c 23

A/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B

A/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B A/B (2018/06/08) 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 6 8 A/B 1 2018 6 8 2 1 1 1.1 OHP.................................... 1 1.2

More information

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

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

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

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

Microsoft PowerPoint - kougi9.ppt

Microsoft PowerPoint - kougi9.ppt C プログラミング演習 第 9 回ポインタとリンクドリストデータ構造 1 今まで説明してきた変数 #include "stdafx.h" #include int _tmain(int argc, _TCHAR* argv[]) { double x; double y; char buf[256]; int i; double start_x; double step_x; FILE*

More information

ex14.dvi

ex14.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 information

ファイル入出力

ファイル入出力 C プログラミング Ⅱ の基礎 とは ファイルへデータを書き込んだり ( 出力 ), ファイルからデータを読み込んだり ( 入力 ) する C 言語では キーボードからの入力 画面への出力と同じようなコードで 処理を実現できる プログラム 入力 出力 ファイル 出力 入力 2 入出力の基本 ストリーム プログラム上で様々な装置への入出力を行う機構様々な入出力装置を統一的な方法で扱うことができる ハードディスクなどではファイルデータによって入出力が行われる

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

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

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS 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 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

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

slide4.pptx

slide4.pptx ソフトウェア工学入門 第 4 回ライブラリ関数 ライブラリ関数 stdio stdio : 標準入出力ライブラリ カーネルレベルのストリームに API を追加し インタフェースを提供する カーネル fd read(2) write(2) stdio バッファ BUFSIZ プログラム BUFSIZ ごと 小さい単位 バッファ : 一時的にデータを保存しておく場所のことバッファリング : バッファを経由してデータをやり取りすること

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

Taro-ファイル処理(公開版).jtd

Taro-ファイル処理(公開版).jtd ファイル処理 0. 目次 1. はじめに 2. ファイル内容の表示 3. ファイル内容の複写 3. 1 文字単位 3. 2 行単位 4. 書式付き入出力 5. 文字配列への入出力 6. 課題 6. 1 課題 1 ( ファイル圧縮 復元 ) - 1 - 1. はじめに ファイル処理プログラムの形は次のようになる #include main() { FILE *fp1,*fp2; ファイルポインタの宣言

More information

Microsoft PowerPoint - 10Com2.ppt

Microsoft PowerPoint - 10Com2.ppt リダイレクトとは コマンドプロンプト操作 (2) リダイレクト パイプ 標準入出力プログラム コマンド行引数 関数 system() 今日のポイン リダイレクトとパイプを使いこなそう 標準入力 標準出力 標準エラー出力を " デフォルト " から別のファイルに割り当てる操作 " デフォルト " は CON ( コンソール ) で 実際の入力はキーボード 出力はディスプレイ 標準入力は 0< ファイル名

More information

ファイル入出力

ファイル入出力 C プログラミング Ⅱ の基礎 とは ファイルへデータを書き込んだり ( 出力 ), ファイルからデータを読み込んだり ( 入力 ) する C 言語では キーボードからの入力 画面への出力と同じようなコードで 処理を実現できる プログラム 入力 出力 ファイル 出力 入力 2 入出力の基本 ストリーム プログラム上で様々な装置への入出力を行う機構様々な入出力装置を統一的な方法で扱うことができる ハードディスクなどではファイルデータによって入出力が行われる

More information

gengo1-12

gengo1-12 外部変数 関数の外で定義される変数を外部変数 ( 大域変数 ) と呼ぶ 外部変数のスコープは広域的 ( プログラム全体 ) 全ての関数で参照可能 int a=10; double x=3.14159; printf( a = %d\n, a); sample(); printf( %f\n, x); void sample(void) printf( %f\n, x); x += 1.0; 外部変数

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information

gengo1-12

gengo1-12 外部変数 関数の外で定義される変数を外部変数 ( 大域変数 ) と呼ぶ 外部変数のスコープは広域的 ( プログラム全体 ) 全ての関数で参照可能 int a=10; double x=3.14159; printf( a = %d\n, a); sample(); printf( %f\n, x); void sample(void) printf( %f\n, x); x += 1.0; 外部変数

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

新版明解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

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include

More information

C言語入門

C言語入門 1 C 言語入門 第 7 週 プログラミング言語 Ⅰ( 実習を含む ), 計算機言語 Ⅰ 計算機言語演習 Ⅰ, 情報処理言語 Ⅰ( 実習を含む ) 2 吐き出し法 ( ガウスの消去法 ) のピボッティング 前回の復習 3 連立一次方程式を行列で計算する 吐き出し法 ( ガウスの消去法 ) ステップ 1: 前進消去 ( 上三角行列の作成 ) gaussian_elimination1.c // step1

More information

Microsoft PowerPoint - kougi4.ppt

Microsoft PowerPoint - kougi4.ppt C の実行モデル 自由落下距離 前回の授業の 例題 1 の復習と重要事項 の確認 地上で物を落とし始めた後の自由落下距離を 求める 重力加速度 g は 9.8 とする 自由落下距離を求めるために, プログラム中に, 計算式 y = ( 9.8 / 2.0 ) * x * x を書く C++ ソースファイルの編集 編集画面 編集中のファイル名 関係するファイルなどが表示される ビルド結果などが表示される画面

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

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

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

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

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

情報処理演習 B8クラス

情報処理演習 B8クラス 予定スケジュール ( 全 15 回 ) 1 1. 終了 プログラミング言語の基礎 2. 終了 演算と型 3. 終了 プログラムの流れの分岐 (if 文,switch 文など ) 4. 終了 プログラムの流れの繰返し (do, while, for 文など ) 5. 終了 中間レポート1 6. 終了 配列 7. 終了 関数 8. 終了 文字列 ( 文字列の配列, 文字列の操作 ) 9. 終了 ポインタ

More information

joho07-1.ppt

joho07-1.ppt 0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

18 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 ( ) 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 information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

gengo1-12

gengo1-12 外部変数 関数の外で定義される変数を外部変数 ( 大域変数 ) と呼ぶ 外部変数のスコープは広域的 ( プログラム全体 ) 全ての関数で参照可能 int a=10; double x=3.14159; printf( a = %d\n, a); sample(); printf( %f\n, x); void sample(void) printf( %f\n, x); x += 1.0; 外部変数

More information

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

Microsoft Word - Cプログラミング演習(9) 第 9 回 (6/18) 3. ファイルとその応用 外部記憶装置に記録されたプログラムやデータを, ファイルと呼ぶ シーケンシャルファイルやランダムファイルへのデータの記録や読み出し, 更新の手順について学習する (1) ファイルとレコードファイル複数の関連したデータを一つに集めたり プログラムを外部記憶装置に保存したものレコードファイルを構成する一塊のデータ ex. 個人カードフィールドレコードを構成する個別の要素

More information

Microsoft PowerPoint - kougi8.ppt

Microsoft PowerPoint - kougi8.ppt C プログラミング演習 第 8 回構造体とレコードデータファイル 1 例題 1. バイナリファイル形式のファイル からのデータ読み込み 次のような名簿ファイル ( バイナリファイル形式 ) を読み込んで, 画面に表示するプログラムを作る name Ken Bill Mike age 20 32 35 address NewYork HongKong Paris 名簿ファイル 2 #include "stdafx.h"

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

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

tuat2.dvi

tuat2.dvi ( 2 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 7 7 ( 2 ) 1 / 54 (1) (2) (?) (1) (2) 2 ( 2 ) 2 / 54 1. 30 2. 2012 6 30 25 OS ( 2 ) 3 / 54 10 20 1993 1996 2000 2003 = 30 ( 2 ) 4 / 54 1 2 2 ( 2 ) 5 /

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

新・明解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

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

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

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

演算増幅器

演算増幅器 ファイルこれまでにデータの入力方法として キーボードからの入力を用いてきた 構造体を習った際に実感してもらえたと思うが 入力データ量が多いときにはその作業は大変なものとなり 入力するデータを間違えた場合には最初からやり直しになる そこで今回はこれらの問題を解決するため あらかじめ入力データをテキストエディタなどで編集し ファイルとして保存したものを入力データとして用いる方法を習っていく さらにプログラムで作成したデータをファイルに出力する方法も併せて習っていく

More information

スライド タイトルなし

スライド タイトルなし ファイル入出力 (2) これまでのおさらい ( 入出力 ) これまでの入出力は 入力 scanf 出力 printf キーボードと画面 ( 端末 ) scanf/printf は 書式つき入出力 フォーマットを指定する 標準入出力を対象とする 何もしなければ 標準入出力は キーボードと画面 ストリームという考え方 ストリーム (stream) = データの列 キーボードから打つ文字列 画面に出力される文字列

More information

ディジタル信号処理

ディジタル信号処理 http://www.cfme.chiba-u.jp/~yama// C 言 語 におけるファイル 入 出 力 テキスト バイナリの 取 り 扱 い ( )..[4]% gcc Wall o hoge hoge.c..[5]%./hoge 1 : 1 2 : 2 3 : 3 4 : 0 6..[6]% (! )..[4]% gcc Wall o hoge hoge.c..[5]%!g gcc Wall

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

: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 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D 6 2019 5 14 6.1 Minimum C....................... 6 1 6.2....................................... 6 7 6.1 Minimum C Minimum C BNF T okenseq W hite Any Digit ::= 0 1 2... 9. Number ::= Digit Digit. Alphabet

More information

計算機プログラミング

計算機プログラミング プログラミング言語 C 第 8 講 システム標準関数 ( 入出力関数 ) システム標準関数 システムに備え付けの関数 例 ) printf( ); scanf( ); 標準出力関数 標準入力関数 A. 入出力用の関数 高水準入出力関数 高水準言語 (OS に依存しない ) 低水準入出力関数 機械語レベル (OS に依存 ) B. それ以外の関数 引数と関数の型 ( 戻り値 ) に注目しましょう 例

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 3 回構造体, ファイル入出力 先週の出席確認へのコメント 暗号を破りたいが 平文の候補が多すぎる 人間の目で確認する代わりに どんなプログラムがあればよいか? 辞書を挙げた人が多かった 正しい着眼です 何億個もの平文候補が想定されるので 形態素解析や品詞判別を挙げた人もいます 辞書に近い回答で悪くはないのですが 平文候補ごとにあまり高機能なものを呼び出すと時間がかかる

More information

Microsoft PowerPoint - kougi2.ppt

Microsoft PowerPoint - kougi2.ppt C プログラミング演習 第 2 回 Microsoft Visual Studio.NET を使ってみよう 説明 例題 1. プログラム実行の体験 コンピュータを役に立つ道具として実感する 次ページのプログラムを使って, Microsoft Visual Studio.NETでの C++ ソースファイル編集, ビルド, テスト実行の一連の過程を体験する 例題 1 のプログラムの機能 計算の繰り返し

More information

Microsoft PowerPoint - guidance.ppt

Microsoft PowerPoint - guidance.ppt 例題 1. プログラム実行の体験 Microsoft Visual C++ を使ってみよう コンピュータを役に立つ道具として実 感するために, 次ページのプログラムを使って, Microsoft Visual C++ で のプログラム実行を体験する 例題 1 のプログラムの機能 計算の繰り返し キーボードからのデータ読み込み ファイルへの書き出し #include #include

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

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

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

Microsoft PowerPoint - kougi6.ppt

Microsoft PowerPoint - kougi6.ppt C プログラミング演習 第 6 回ファイル処理と配列 1 ファイル処理 2 ファイル読み込み ファイル プログラム ファイルの中身は変わらない 3 ファイル書き出し ファイル プログラム ファイルの中身が変わる ファイルは伸び縮みすることがある 4 例題 1. テキストファイル形式の ファイルからのデータ読み込み 次のような名簿ファイル ( テキストファイル形式 ) を読み込んで,1 列目の氏名と,3

More information

P05.ppt

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

More information

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

filea fileb fp = fopen(a, r); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen(b, r); while(fgets(line, BUFSIZ, fp)) {... fclose I117 9 2 School of Information Science, Japan Advanced Institute of Science and Technology file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line,

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング初級 第 13 回 2017 年 7 月 10 日 標準ライブラリ関数 1 標準ライブラリ関数とは 関数には (1) 自分で作る関数 (2) はじめから用意されている関数特に C 言語用用意されているもの : 標準ライブラリ関数 文字列の代入文字列の長さを求める文字列の比較文字列の連結 strcpy strlen strcmp strcat 2 文字列の操作 - 具体例を通して (141

More information

pptx

pptx iphone 2010 8 18 C xkozima@myu.ac.jp C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

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

Microsoft Word - Cプログラミング演習(12) 第 12 回 (7/9) 4. いくつかのトピック (5)main 関数の引数を利用したファイル処理 main 関数は, 起動する環境から引数を受け取ることができる 例えば 次に示すように,main 関数に引数を用いたプログラムを作成する 01 /* sample */ 02 /* main 関数の引数 */ 03 #include 04 05 main(int argc, char

More information

Microsoft Word - 06

Microsoft Word - 06 平成 24 年度講義 アルゴリズムとデータ構造 第 6 回ファイル入出力 担当 : 富井尚志 (tommy@ynu.ac.jp) 第 6 回 ファイル入出力 前回 ( 第 5 回 ) 配列を扱うアルゴリズム (2) とポインタ の復習 集合を扱う 集合の表現, 配列を使った表現, 要素の列 を 集合 にする, 要素, 積, 和, 差 文字列 C 言語における文字列, 文字列を扱うプログラム 計算機の記憶とポインタ

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

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

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

comment.dvi

comment.dvi ( ) (sample1.c) (sample1.c) 2 2 Nearest Neighbor 1 (2D-class1.dat) 2 (2D-class2.dat) (2D-test.dat) 3 Nearest Neighbor Nearest Neighbor ( 1) 2 1: NN 1 (sample1.c) /* -----------------------------------------------------------------

More information

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

Microsoft PowerPoint - CproNt11.ppt [互換モード] 第 11 章入出力関数とライブラリ関数 CPro:11-01 概要 getchar putchar gets puts scanf printf strcat strcmp strcpy strlen atoi atof sprint sscanf 11.1 コンソール入出力関数 11-02 入力 出力 getchar putchar 一文字 gets puts 文字列 ( 一行 ) scanf printf

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (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

memo

memo 数理情報工学演習第一 C ( 第 12 回 ) 2016/07/11 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : ファイルの入出力 コマンドライン引数 2 分探索 クイックソート ( ライブラリ ) 文字列検索 2 ファイル操作の手続き : ファイル操作 ファイルからのデータ読み込み ファイルへのデータ書き出し 基本的な手順 読みこむ / 書き出すファイルを開く

More information

ゲームエンジンの構成要素

ゲームエンジンの構成要素 cp-3. 計算 (C プログラムの書き方を, パソコン演習で学ぶシリーズ ) https://www.kkaneko.jp/cc/adp/index.html 金子邦彦 1 本日の内容 例題 1. 自由落下距離四則演算例題 2. 三角形の面積浮動小数の変数, 入力文, 出力文, 代入文例題 3. sin 関数による三角形の面積ライブラリ関数 2 今日の到達目標 プログラムを使って, 自分の思い通りの計算ができるようになる

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

I J

I J I 065763J 8 7 7 31 jikken/ +----- accumulation_demupa.c +----- accumulation_rain.c +----- frequency_demupa.c +----- frequency_rain.c +----- go.sh +----- graph_maker.sh +----- mesure-ryudai/ 2007/4/1 2007/6/30

More information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション 構造体 (struct) 構造体の宣言 typedef 宣言 配列では 複数のデータをひとまとまりにして操作することが出来る しかし それぞれのデータは同じ型 ( 例えば整数 あるいは浮動小数点数 ) 出なければならない 型の違うデータをひとまとまりにして扱う方法に 構造体がある 構造体 文文文文名前字 ( 文字列字字 ) 字 整数学籍番号 ( 整数 ) 身長 ( 浮動小数点数 ) 文字 配列 3

More information

ポインタ変数

ポインタ変数 プログラミング及び実習 7 馬青 1 文字列処理 文字列 文字列は " ( ダブルクォーテーション ) で囲んで表現される 文字列というデータ型が存在しないので 文字列は文字の配列 あるいはポインタ変数として扱われる また 文字の配列あるいはポインタ変数を宣言するときのデータ型は char を用いる 従って char s[]="ryukoku Uni."; あるいは char *s="ryukoku

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

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

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

Microsoft PowerPoint pptx

Microsoft PowerPoint pptx 情報処理 Ⅱ 第 12 13回 2011 年 1 月 31 17 日 ( 月 ) 本日学ぶこと ファイル入出力, 標準入力 標準出力 記憶域管理関数 (malloc など ) 問題 ファイルを入力にとり, 先頭に行番号をつけて出力できる? 行列の積を, ファイルを介して読み書き 計算できる? Wakayama University./line 1:Wakayama 2:University 3 2

More information

Microsoft PowerPoint pptx

Microsoft PowerPoint pptx 情報処理 Ⅱ 2012 年 1 月 1~2 月のスケジュール 1 月 16 日 ( 月 ): 第 12 回授業 1 月 19 日 ( 木 ): レポート課題提出期限 17:00 までに, 学科事務室前に提出 1 月 23 日 ( 月 ): 第 13 回授業 1 月 30 日 ( 月 ): 第 14 回授業,A601で実施 1 月 31 日 ( 火 ): 第 15 回授業, おさらい問題 (2 月 6

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

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(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 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

10

10 2: http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp 10 : 0 1 2 n 2 n 0 1 1 0 1 0 0 1 (2) = 105 1 = 8 1 2 8 = 256 0 9 105 i 106 j 256 2 1 #include int main(void)

More information

ポインタ変数

ポインタ変数 プログラミング及び実習 6 馬青 1 例 : ファイルデータの整形 以下の ipt.dat ファイルを opt.dat ファイルに変換するプログラム ipt.dat の中の空白は空白かタブであり opt.dat の中の No と番号の間は 1 個の空白で 番号と点数の間は 1 個のタブである 2 データ ipt.dat no.1 79 no.2 73 no.3 89 no.4 67 no.5 99

More information

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

Cプログラミング1(再) 第2回

Cプログラミング1(再) 第2回 C プログラミング 1( 再 ) 第 2 回 講義では Cプログラミングの基本を学び演習では やや実践的なプログラミングを通して学ぶ 1 前回のレポートから 前回の宿題 数あてゲーム の説明において 次のように書いていたものがいた : これはコンピュータがランダムに設定した数字を人間が当てるゲームである この説明でどこかおかしなところはないだろうか? 2 コンピュータの用語と日常的な用語の違い 物理において

More information

memo

memo 数理情報工学演習第一 C プログラミング演習 ( 第 5 回 ) 2015/05/11 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : プロトタイプ宣言 ヘッダーファイル, プログラムの分割 課題 : 疎行列 2 プロトタイプ宣言 3 C 言語では, 関数や変数は使用する前 ( ソースの上のほう ) に定義されている必要がある. double sub(int

More information

C言語講座 ~ファイル入出力編~

C言語講座 ~ファイル入出力編~ C 言語講座 ~ ファイル入出力編 ~ ポインタ使います 例 2 練習問題 3 初めに プログラムを組む上での話と今回の演習について 例えばこの画面の場合 背景の動画の描写 ノーツを流れてくるようにする ボタンを押したら違反亭ライン近くのノーツは消えるようにする処理 曲の難易度ごとに判定を追加とか残りの処理 完成 演習 1 クリア 演習 2 クリア 過程は各自で考えてください 演習 3 クリア ファイルの出入力でこれからやること

More information

ディジタル信号処理

ディジタル信号処理 信号処理論 ディジタル画像処理 C 言語におけるファイル入出力 テキスト バイナリの取り扱い ( )..[4]% gcc Wall o hoge hoge.c..[5]%./hoge 1 : 1 2 : 2 3 : 3 4 : 0 6..[6]% (! )..[4]% gcc Wall o hoge hoge.c..[5]%!g gcc Wall o hoge hoge.c..[6]%!! gcc

More information