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

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

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

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

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

1.ppt


PSCHG000.PS

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

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

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


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

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

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

10

福岡大学人文論叢47-3

超初心者用

HTML

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

joho07-1.ppt

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

PowerPoint Presentation

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

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

‚æ4›ñ

WinHPC ppt

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

r08.dvi

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

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

P05.ppt

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

101NEO資料

ohp08.dvi


C C UNIX C ( ) 4 1 HTML 1

導入基礎演習.ppt

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

untitled

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

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

Java

K227 Java 2

浦安ライオンズクラブ81獅子吼.indd

<348C8E8D862E696E6464>

MPI MPI MPI.NET C# MPI Version2

ex12.dvi

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

Microsoft PowerPoint - 計算機言語 第7回.ppt

pptx

RHEA key

卒 業 研 究 報 告.PDF



人事行政の運営状況等の公表(平成19年12月)(PDF)


mogiJugyo_slide_full.dvi

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

±é½¬£²¡§£Í£Ð£É½éÊâ

ex01.dvi

r03.dvi

EPSON VP-1200 取扱説明書

ex01.dvi

PSCHG000.PS


main

ohp03.dvi

Microsoft Word - Training10_プリプロセッサ.docx

Java updated

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

2 Eclipse 2.1 Eclipse 1. Eclipse 2. 3 ( 4) E:Yworkspace OK 3 Eclipse 4 3. Eclipse 5 5 Eclipse Eclipse 2. 7 C 2

Condition DAQ condition condition 2 3 XML key value

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

XMPによる並列化実装2

& & a a * * ptr p int a ; int *a ; int a ; int a int *a



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

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

EOS 70D (W) Wi-Fi機能 使用説明書

文字列操作と正規表現


新たな基礎年金制度の構築に向けて

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

48 * *2

P06.ppt

Java プログラミング Ⅰ 3 回目変数 変数 変 数 一時的に値を記憶させておく機能型 ( データ型 ) と識別子をもつ 2 型 ( データ型 ) 変数の種類型に応じて記憶できる値の種類や範囲が決まる 型 値の種類 値の範囲 boolean 真偽値 true / false char 2バイト文

プログラム

2 3


tuat1.dvi

02: 変数と標準入出力

untitled

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO

関数 C 言語は関数の言語 関数とは 関数の定義 : f(x) = x * x ; 使うときは : y = f(x) 戻り値 引数

橡Pro PDF

ポインタ変数

ファイル入出力

B

Transcription:

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 Download........................................ 1 1.3.............................. 1 1.4....................................... 16 1.4.1 20180608-01 : 3.................. 16 1 http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2 http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/20180608/20180608.html 1

1 1.1 OHP OHP (HTML) 3 (PDF) 4 1.2 Download 20180608-update.zip 5 hanoi.zip 6 miku.zip 7 sample-20180608.c 8 1.3 20180601-01-9999.c 9 (20180601-01-9999.c (SJIS) 10 ) 1: 20180601-01-9999.c 20180601-01-QQQQ.c #include <strings.h> double_print (message) [ : ] double_print ( "" ); "" ( ) double_print ( "abc" ); aabbcc double_print ( "abcdef" ); ^^^ aabbccddeeff 3 ohp/html/index.html 4 ohp/ohp.pdf 5 files/20180608-update.zip 6 files/hanoi.zip 7 files/miku.zip 8 files/sample-20180608.c 9 p/20180601-01-9999.c 10 p/sjis/20180601-01-9999.c 1

^^^^^^====== duble_print ( "abcdef" ) duble_print ( "abc" ) aabbcc duble_print ( "def" ) ddeeff duble_print ( "abcdef" ) a double_print ( "bcdef" ) duble_print ( message ) message message putchar double_print ( message + 1 ) void double_print ( char message ) { if (!strcmp ( message, "" ) ) { putchar ( message ); double_print ( message + 1 ); main int main ( void ) { double_print ( "abc" ); printf ( "\n" ); double_print ( "1234567" ); printf ( "\n" ); 20180601-02-9999.c 11 (20180601-02-9999.c (SJIS) 12 ) 11 p/20180601-02-9999.c 12 p/sjis/20180601-02-9999.c 2

2: 20180601-02-9999.c 20180601-02-QQQQ.c #include <strings.h> reverse_print (message) void reverse_print ( char message ) { if (!strcmp ( message, "" ) ) {... main int main ( void ) { putchar ( message ); reverse_print ( message + 1 );....... : ; reverse_print ( "abc" ); printf ( "\n" ); reverse_print ( "1234567" ); printf ( "\n" ); 3

hanoi3.c 13 (hanoi3.c (SJIS) 14 ) 3: hanoi3.c 2018/06/08 hanoi3.c 3 s_hanoi.h #include "s_hanoi.h" int main ( void ) { "1" s_hanoi_init() : : s_hanoi_size ( char discs ) : s_hanoi_move ( char from, char to ) : from to s_hanoi_clear () : s_hanoi_stop() : : return 0 s_hanoi_init(); s_hanoi_size ( "" ); // 3 putchar ( > ); putchar ( getchar() ); s_hanoi_move ( "1", "3" ); [1] 1 3 putchar ( > ); putchar ( getchar() ); s_hanoi_move ( "1", "2" ); [2] 1 2 putchar ( > ); putchar ( getchar() ); s_hanoi_stop(); 13 p/hanoi3.c 14 p/sjis/hanoi3.c 4

p-001.c 15 (p-001.c (SJIS) 16 ) 4: p-001.c n (nprint) void nprint(char ntimes) { if (!strcmp ( ntimes, "" ) ) { ntimes do nothing printf ( "Hello, World\n" ); nprint ( ntimes + 1 ); nprint ( "" ); nprint ( "12345" ); p-002.c 17 (p-002.c (SJIS) 18 ) 5: p-002.c n (nprint) void nprint(char ntimes, char message) { 15 p/p-001.c 16 p/sjis/p-001.c 17 p/p-002.c 18 p/sjis/p-002.c if (!strcmp ( ntimes, "" ) ) { do nothing 5

printf ( message ); nprint ( ntimes + 1, message ); nprint ( "", "Hello, World\n" ); nprint ( "12345", " \n" ); p-003.c 19 (p-003.c (SJIS) 20 ) 6: p-003.c n (nprint) void nprint(char ntimes, char message) { if (!strcmp ( ntimes, "" ) ) { do nothing printf ( message ); nprint ( ntimes + 1, message + 1); nprint ( "", "Hello, World\n" ); nprint ( "12345", " \n" ); 19 p/p-003.c 20 p/sjis/p-003.c 6

p-004.c 21 (p-004.c (SJIS) 22 ) 7: p-004.c printf ( " \"abc\" " ); putchar ( "abc" ); "abc" a printf ( " \n" ); p-005.c 23 (p-005.c (SJIS) 24 ) 8: p-005.c printf ( " \"abc\" + 1 " ); putchar ( ("abc"+1) ); "abc" b printf ( " \n" ); p-006.c 25 (p-006.c (SJIS) 26 ) 9: p-006.c printf ( " \"abc\" + 1 " ); putchar ( "abc"[1] ); "abc" b "abc"[1] => ("abc"+1) 21 p/p-004.c 22 p/sjis/p-004.c 23 p/p-005.c 24 p/sjis/p-005.c 25 p/p-006.c 26 p/sjis/p-006.c 7

printf ( " \n" ); p-007.c 27 (p-007.c (SJIS) 28 ) 10: p-007.c n (nprint) void nprint(char ntimes) { "" if ( ntimes == \0 ) { ntimes \0 (EOS) do nothing printf ( "Hello, World\n" ); nprint ( ntimes + 1 ); ntimes "" nul nprint ( "" ); nprint ( "12345" ); p-008.c 29 (p-008.c (SJIS) 30 ) 11: p-008.c myprintf 27 p/p-007.c 28 p/sjis/p-007.c 29 p/p-008.c 30 p/sjis/p-008.c 8

myprintf ( "abc" ); => abc Version 1 : printf void myprintf (char string) { printf ( string ); printf myprintf ( "Hello, World\n" ); myprintf ( " \n" ); p-009.c 31 (p-009.c (SJIS) 32 ) 12: p-009.c myprintf myprintf ( "abc" ); => abc Version 2 : printf putchar myprintf ( "abc" ); => abc => a bc => putchar ( a ); myprinf ( "bc" ); => putchar ( "abc" ); myprinf ( "abc" + 1 ); myprintf ( string ); => putchar ( string ) ; myprintf ( string + 1 ); string "" void myprintf (char string) { if ( string == \0 ) { putchar ( string ); myprintf ( string + 1 ); 31 p/p-009.c 32 p/sjis/p-009.c myprintf ( "Hello, World\n" ); myprintf ( " \n" ); 9

p-010.c 33 (p-010.c (SJIS) 34 ) 13: p-010.c myprintf version 3 (^o^) void myprintf (char string) { if ( string == \0 ) { if ( string == ) { printf ( "(^o^)" ); putchar ( string ); myprintf ( string + 1 ); printf ( "Hello, World\n" ); myprintf ( "Hello, World\n" ); printf ( "Hello, World \n" ); myprintf ( "Hello, World \n" ); p-011.c 35 (p-011.c (SJIS) 36 ) 14: p-011.c 33 p/p-010.c 34 p/sjis/p-010.c 35 p/p-011.c 36 p/sjis/p-011.c 10

myprintf version 3 (^o^) #define EOS \0 \0 EOS EOS \0 EOS = End Of String EOS \0 #define SMAILE void myprintf (char string) { if ( string == EOS ) { if ( string == SMAILE ) { printf ( "(^o^)" ); putchar ( string ); myprintf ( string + 1 ); printf ( "Hello, World\n" ); myprintf ( "Hello, World\n" ); printf ( "Hello, World \n" ); myprintf ( "Hello, World \n" ); p-012.c 37 (p-012.c (SJIS) 38 ) 15: p-012.c n (nprint) nprint ( "abc" ); => Hello, World Hello, World 37 p/p-012.c 38 p/sjis/p-012.c 11

Hello, World => Hello, World Hello, World Hello, World => printf ( "Hello, World\n" ): nprint ( "bc" ); nprint ( "abc" ); => Hello, World Hello, World Hello, World => Hello, World Hello, World Hello, World => nprint ( "bc" ); printf ( "Hello, World\n" ): void nprint(char ntimes) { if (!strcmp ( ntimes, "" ) ) { ntimes do nothing nprint ( ntimes + 1 ); printf ( "Hello, World\n" ); nprint ( "" ); nprint ( "12345" ); p-013.c 39 (p-013.c (SJIS) 40 ) 16: p-013.c 39 p/p-013.c 40 p/sjis/p-013.c 12

n (nprint) nprint ( "" ) => => => printf ( "" ); printf ( "\n" ); nprint ( "" ); [ ] nprint ( message ) => printf ( message ); printf ( "\n" ); nprint ( message + 1 ); #define EOS \0 void nprint(char ntimes) { if ( ntimes == EOS ) { ntimes do nothing printf ( ntimes ); printf ( "\n" ); putchar ( \n ) nprint ( ntimes + 1 ); nprint ( "" ); nprint ( "12345" ); p-014.c 41 (p-014.c (SJIS) 42 ) 17: p-014.c 41 p/p-014.c 42 p/sjis/p-014.c 13

n (nprint) nprint ( "" ) => nprint ( "" + 1 ); printf ( "" ); printf ( "\n" ); => nprint ( "" ); printf ( "" ); printf ( "\n" ); => nprint ( "" + 1 ); printf ( "" ); printf ( "\n\" ); printf ( "" ); printf ( "\n" ); =>.. => #define EOS \0 void nprint(char ntimes) { if ( ntimes == EOS ) { ntimes do nothing nprint ( ntimes + 1 ); printf ( ntimes ); printf ( "\n" ); putchar ( \n ) nprint ( "" ); nprint ( "12345" ); 14

memo.txt 43 (memo.txt (SJIS) 44 ) 18: memo.txt [ ] => n : [ ] "ABC" : 3 A, B, C [C?] : "abc" <=> a "abc" + 1 => "bc" ("abc"+1) => ("bc") => b "abc" => "abc" 0 ( ) "abc" => ("abc"+0) ("abc"+1) => "abc" 1 ( ) ("abc"+n) => "abc" n "abc"[n] "abc"[n] => ("abc"+n) "abc" 0, "abc"[0] "" ( 0 ) "" => \0 ( : ) "abc" = { a, b, c, \0 "" = { \0 # \0 nul End of String (EOS) str str == \0!strcmp ( str, "" )!strcmp ==!! = == == 43 p/memo.txt 44 p/sjis/memo.txt 15

#define #define 20180601-01 double_print ( "abc" ); => aabbcc 20180601-02 reverse_print ( "abc" ); => cba => cb a => reverse_print ( "bc" ); putchar ( a ) => reverse_print ( "abc" + 1 ); putchar ( "abc" ) [ ] reverse_print ( message ); => reverse_print ( message + 1 ); putchar ( message ); 1.4 1.4.1 20180608-01 : 3 Download : 20180608-01.c 45 19: 20180608-01.c 20180608-01-QQQQ.c 3 s_hanoi.h #include "s_hanoi.h" int main ( void ) { 45 ex/01/q/01.c 16

"1" "2" s_hanoi_init() : : s_hanoi_size ( char discs ) : s_hanoi_move ( char from, char to ) : from to s_hanoi_clear () : s_hanoi_stop() : : return 0 s_hanoi_init(); s_hanoi_set ( char discs ) 3 printf ( " [Enter] \n" ); putchar ( > ); putchar ( getchar() ); (3) s_hanoi_move ( "1", "2" ); 1 2 ( 1 ) s_hanoi_move ( "1", "3" ); 1 3 ( 2 ) s_hanoi_move ( "1", "2" ); 1 2 ( 3 ) s_hanoi_move ( "3", "1" ); 3 1 ( 1 ) s_hanoi_move ( "1", "2" ); 1 2 ( 1 ) printf ( " [Enter] \n" ); putchar ( > ); putchar ( getchar() ); s_hanoi_stop(); 17

$./20180608-01-QQQQ.exe $ 1: 20180608-01.c 18