¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

Size: px
Start display at page:

Download "¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse"

Transcription

1 I Exercise on Programming I 12 of 14 ( RD S ) I 12 of 14 1 / 35

2 ( RD S ) I 12 of 14 2 / 35

3 game.rb ( RD S ) I 12 of 14 3 / 35

4 game.rb 11 ( ) 1 require "io/console" 2 require "timeout" 3 k = "" 4 x = 5 5 sp = 1 6 life = 3 7 score = 0 8 buf = [] 9 while true 10 buf.unshift(" " * rand(40) + "#" * (score / 15)) 11 buf = buf[0, 9] 12 puts(buf[0]) 13 print("\x1b7\x1b[33m\x1b[10a\x1b[#{x}co\x1b8\x1b[0m") 14 begin 15 Timeout.timeout(0.1) do 16 while true do 17 k = STDIN.getch 18 if k == " " && sp > 0 19 print("\x1b[9a\x1b[j\x1b8") 20 buf = [""] 21 sp = sp else 23 x = (x + (k == "h"? -1 : 1)) % end 25 end 26 end 27 rescue 28 end 29 life = life - 1 if buf[-1][x] == "#" 30 break if life <= 0 31 score = score end 33 puts(score) ( RD S ) I 12 of 14 4 / 35

5 game.rb LIFE O o. ( RD S ) I 12 of 14 5 / 35

6 1 O #{".oo"[life]} print("\x1b( )[#{x}co\x1b8\x1b[0m") print("\x1b( )[#{x}c#{".oo"[life]}\x1b8\x1b[0m") ( RD S ) I 12 of 14 6 / 35

7

8 S t r i n g I n t e g e r variable str = gets.chomp val = gets.to_i.to_s.to_i if else end while end break ( RD S ) I 12 of 14 8 / 35

9 0 sumall_919???.rb $ ruby sumall_ rb # 31 # # # # 0 42 # (-16)=42 e @edu1: $ ( RD S ) I 12 of 14 9 / 35

10 sum = 0 while true x = gets.to_i break if x == 0 sum = sum + x end puts(sum) ( RD S ) I 12 of / 35

11 1 sum = 0 2 while true 3 break if (x = gets.to_i) == 0 4 sum = sum + x 5 end 6 puts(sum) a = x=gets.to_i ( RD S ) I 12 of / 35

12 n

13 : n.times do end 10.times do puts("hello, world") end ( RD S ) I 12 of / 35

14 n?.times do end a = gets.to_i a.times do i puts(i) end ( RD S ) I 12 of / 35

15 times i break 5 10 (5..10).each do i end (5..10).each do i puts(i * 3) end ( RD S ) I 12 of / 35

16 times times sum3_100.rb (5 ) e1x19123@edu2: $ ruby sum3_100.rb 1683 e1x19123@edu2: $ ( RD S ) I 12 of / 35

17 (a.k.a. )

18 : x x = 10 puts("-" * x) puts(" " * (x - 1) + " ") puts("-" * x) e1x19123@edu2: $ ruby barchart.rb e1x19123@edu2: $ ( RD S ) I 12 of / 35

19 : x x = 10 puts("-" * x) puts(" " * (x - 1) + " ") puts("-" * x) e1x19123@edu2: $ ruby barchart.rb e1x19123@edu2: $ ( RD S ) I 12 of / 35

20 = def end def draw_bar x = 10 puts("-" * x) puts(" " * (x - 1) + " ") puts("-" * x) end ( RD S ) I 12 of / 35

21 def draw_bar # x = 10 # puts("-" * x) # puts(" " * (x - 1) + " ") # puts("-" * x) # end # draw_bar draw_bar # 1 # 2 ( RD S ) I 12 of / 35

22 barchart.rb ( RD S ) I 12 of / 35

23 1: def draw_bar # end 10.times do # 10 draw_bar # end # ( RD S ) I 12 of / 35

24 :! def draw_bar x = 10 puts("-" * x) puts(" " * (x - 1)) puts("-" * x) end def draw_bar(x) puts("-" * x) puts(" " * (x - 1) + puts("-" * x) end ( RD S ) I 12 of / 35

25 : 2 draw_bar(10) draw_bar(3) draw_bar(8) x 10, 3, 8 ( RD S ) I 12 of / 35

26 ok! def draw_bar(x, f) puts("-" * x) puts(f * (x - 1) + " " + x.to_s) puts("-" * x) end # f # f draw_bar(20, "/") draw_bar(8, " ") draw_bar(13, "X") ( RD S ) I 12 of / 35

27 ( ) ( ) / Q.? def hoge a = 0 b = 456 end a = 123 puts(a) hoge puts(a) puts(b) ( RD S ) I 12 of / 35

28 bus_fare busfare.rb 0 e1x19123@edu2: $ ruby busfare.rb 2 # [ ] 2 3 # [ ] # [ ] # [ ] 0 4 # [ ] # [ ] # [ ] 0 0 # [ ] 0 e1x19123@edu2: $ ( RD S ) I 12 of / 35

29 3 Fizz 5 Buzz 3 5 Fizz Buzz 3 5 fizz_buzz 0 49 Fizz Buzz fizzbuzz_x19???.rb ( x19??? wx ) ( RD S ) I 12 of / 35

30 ( ) ex919123@edu1: $ ruby fizzbuzz_x19123.rb # Fizz Buzz # Fizz Buzz 1 2 Fizz # 3 3 Fizz 4 Buzz # 5 5 Buzz Fizz # 6 3 Fizz ( ) Fizz # 48 3 Fizz 49 e @edu1: $ ( RD S ) I 12 of / 35

31 fizzbuzz_x19???.rb Google classroom oit.ac.jp/prog1/selfcheck.rb selfcheck.rb ( RD S ) I 12 of / 35

32

33 ( RD S ) I 12 of / 35

34 ( )

35 1 def fizz_buzz(x) # end # 0 49 # fizz_buzz ( ) ( RD S ) I 12 of / 35

36 2 def fizz_buzz(x) # end 50.times do i # end ( RD S ) I 12 of / 35

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 13 of 14 ( RD S ) I 13 of 14 1 / 39 https://bit.ly/oitprog1 ( RD S ) I 13 of 14 2 / 39 game.rb ( RD S ) I 13 of 14 3 / 39 game.rb 12 ( ) 1 require "io/console"

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2

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

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

or a 3-1a (0 b ) : max: a b a > b result a result b ( ) result Python : def max(a, b): if a > b: result = a else: result = b ret

or a 3-1a (0 b ) : max: a b a > b result a result b ( ) result Python : def max(a, b): if a > b: result = a else: result = b ret 4 2018.10.18 or 1 1.1 3-1a 3-1a (0 b ) : max: a b a > b result a result b result Python : def max(a, b): if a > b: result = a result = b return(result) : max2: a b result a b > result result b result 1

More information

r1.dvi

r1.dvi Ruby 2009.9.7 1 ( ) --- ( ( ) ( ) 1 --- ( ) 1 ( ) (?) IT 7K( )?? ( ) ( )? IT ( ) --- ( ) 1 ( ) --- ( ) (?) 2-3% Top-Level ICT Professional 5% ICT Professional 10% 100% 50% 20% Devl. Experiment Adv. ICT

More information

Windows [ ] [ (R)..] cmd [OK] Z:\> mkdir progi [Enter] \ ) mkdir progi ) (command ) help [Enter] help ( help ) mkdir make directory Windows ) mkdir mk

Windows [ ] [ (R)..] cmd [OK] Z:\> mkdir progi [Enter] \ ) mkdir progi ) (command ) help [Enter] help ( help ) mkdir make directory Windows ) mkdir mk Ruby I I 1 Windows 1 Meadow 1: Meadow I Meadow 2 2 Ruby 2.1 I Z progi 1 Windows [ ] [ (R)..] cmd [OK] Z:\> mkdir progi [Enter] \ ) mkdir progi ) (command ) help [Enter] help ( help ) mkdir make directory

More information

untitled

untitled 30 callcc yhara ( ( ) (1) callcc (2) callcc (3) callcc callcc Continuation callcc (1) (2) (3) (1) (2) (3) (4) class Foo def f p 1 callcc{ cc return cc} p 2 class Bar def initialize @cc = Foo.new.f def

More information

1 Ex Ex. 2 2

1 Ex Ex. 2 2 I 20 100 85 40 85 PDF Windows TA ruby TA6 2 8 1. 2. PDF 3. PDF 1 Ex. 1 2 2 Ex. 2 2 2 Ex. 3 seisu = Array.new(3, 0) seisu[0] = gets.chomp.to_i seisu[1] = gets.chomp.to_i seisu[2] = gets.chomp.to_i wa =

More information

parser.y 3. node.rb 4. CD-ROM

parser.y 3. node.rb 4. CD-ROM 1. 1 51 2. parser.y 3. node.rb 4. CD-ROM 1 10 2 i 0 i 10 " i i+1 3 for(i = 0; i

More information

2

2 1 2 3 4 5 6 7 8 9 10 11 12 ( ) RAND [OK] 0 1 13 14 15 16 17 18 19 20 21 1 22 23 24 25 26 27 28 ( ) DDE ( ) ( ) ( ) ( ): ( ): ( ): 29 30 1 1 1 1 31 32 33 34 35 36 37 38 39 40 41 : : : : : ( ) : : 1 42 43

More information

3360 druby Web Who is translating it? http://dx.doi.org/10.1007/s10766-008-0086-1 $32.00 International Journal of PARALLEL PROGRAMING Must buy! http://dx.doi.org/10.1007/s10766-008-0086-1 toruby LT Linux

More information

Microsoft PowerPoint - ruby_instruction.ppt

Microsoft PowerPoint - ruby_instruction.ppt Ruby 入門 流れ Ruby の文法 画面に出力 キーボードから入力 数値 文字列 変数 配列 ハッシュ 制御構造 ( 分岐 繰り返しなど ) if while case for each 関数 クラス Ruby とは プログラミング言語 インタプリタ言語 オブジェクト指向 国産 ウェブアプリケーションフレームワーク RubyOnRails で注目 弊社での Web アプリケーション開発に利用 画面に出力

More information

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript BASIC / / BA- SIC Web 1/10 1/10 // JavaScript MIT Processing line(10,10,100,100); 1 BASIC / Phidgets 1 GAINER 2 USB / Phidgets USB 1: 1 http://www.phidgets.com/ 2 http://gainer.cc/ / / BGM Phidgets University

More information

Ruby 50 Ruby UTF print, \n [Ruby-1] print("hello, Ruby.\n") [Ruby-2] Hello, Ruby. [Ruby-3] print("hello, \"Ruby\".\n") 2 [Ruby-4] seisuu = 10 pr

Ruby 50 Ruby UTF print, \n [Ruby-1] print(hello, Ruby.\n) [Ruby-2] Hello, Ruby. [Ruby-3] print(hello, \Ruby\.\n) 2 [Ruby-4] seisuu = 10 pr Ruby 50 Ruby UTF-8 1 1 print, \n [Ruby-1] print("hello, Ruby.\n") [Ruby-2] Hello, Ruby. [Ruby-3] print("hello, \"Ruby\".\n") 2 [Ruby-4] seisuu = 10 print(seisuu, "\n") jissuu = 3.141592 print(jissuu, "\n")

More information

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 September 2016 1 Windows Cygwin Mac *1 Emacs Ruby 1 1.1 ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 ~/16:00:20> ls 2 2 ls ls -a ~/16:00:20> ls -a

More information

Ruby演習テキスト1

Ruby演習テキスト1 Ruby言語 基礎演習 社会人技術者研修 2014年度 テキスト 社会人技術者研修 2014年度テキスト 2014.11 Ruby基礎演習 1 2014.11 2015.2.1 puts "Hello Ruby >ruby hello.rb ( リターン ) > ruby hello.rb Hello Ruby # はじめての ruby プログラム puts "Hello Ruby" > ruby

More information

3360 druby Web Who is translating it? http://dx.doi.org/10.1007/s10766-008-0086-1 $32.00 International Journal of PARALLEL PROGRAMING Must buy! http://dx.doi.org/10.1007/s10766-008-0086-1 toruby The

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

離散数理工学 第 2回 数え上げの基礎:漸化式の立て方

離散数理工学 第 2回  数え上げの基礎:漸化式の立て方 2 okamotoy@uec.ac.jp 2015 10 20 2015 10 18 15:29 ( ) (2) 2015 10 20 1 / 45 ( ) 1 (10/6) ( ) (10/13) 2 (10/20) 3 ( ) (10/27) (11/3) 4 ( ) (11/10) 5 (11/17) 6 (11/24) 7 (12/1) 8 (12/8) ( ) (2) 2015 10 20

More information

離散数理工学 第 2回 数え上げの基礎:漸化式の立て方

離散数理工学 第 2回  数え上げの基礎:漸化式の立て方 2 okamotoy@uec.ac.jp 2014 10 21 2014 10 29 10:48 ( ) (2) 2014 10 21 1 / 44 ( ) 1 (10/7) ( ) (10/14) 2 (10/21) 3 ( ) (10/28) 4 ( ) (11/4) 5 (11/11) 6 (11/18) 7 (11/25) ( ) (2) 2014 10 21 2 / 44 ( ) 8 (12/2)

More information

-1 - -2 - -3 - -4-2000 -5 - -6 - -7 - -8 - -9 - - 10 - -11-60 200 2,000 1980 24-12 - - 13 - - 14 - - 15 - - 16 - - 17 - 1998 '98 593'98.4. 604'99.3. 1998 '98.10.10 11 80 '98.11. 81'99.3. 49 '98.11. 50

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

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

1. A0 A B A0 A : A1,...,A5 B : B1,...,B 1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 3. 4. 5. A0 A B f : A B 4 (i) f (ii) f (iii) C 2 g, h: C A f g = f h g = h (iv) C 2 g, h: B C g f = h f g = h 4 (1) (i) (iii) (2) (iii) (i) (3) (ii) (iv) (4)

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

Microsoft PowerPoint - 11RubyIntro-No02.ppt [互換モード]

Microsoft PowerPoint - 11RubyIntro-No02.ppt [互換モード] Ruby 入門 東京電機大学櫻井彰人 Ruby とは? Ruby: 松本ゆきひろ氏による (1993) 純粋オブジェクト指向 スクリプト言語 Web プログラムで どんどんポピュラーに Ruby on Rails (http://www.rubyonrails.org/) なぜか きわめて Lisp like 松本行弘 (Matz) Introduction 実行環境 Windows/Unix/Linux/

More information

2 1/2 1/4 x 1 x 2 x 1, x 2 9 3x 1 + 2x 2 9 (1.1) 1/3 RDA 1 15 x /4 RDA 1 6 x /6 1 x 1 3 x 2 15 x (1.2) (1.3) (1.4) 1 2 (1.5) x 1

2 1/2 1/4 x 1 x 2 x 1, x 2 9 3x 1 + 2x 2 9 (1.1) 1/3 RDA 1 15 x /4 RDA 1 6 x /6 1 x 1 3 x 2 15 x (1.2) (1.3) (1.4) 1 2 (1.5) x 1 1 1 [1] 1.1 1.1. TS 9 1/3 RDA 1/4 RDA 1 1/2 1/4 50 65 3 2 1/15 RDA 2/15 RDA 1/6 RDA 1 1/6 1 1960 2 1/2 1/4 x 1 x 2 x 1, x 2 9 3x 1 + 2x 2 9 (1.1) 1/3 RDA 1 15 x 1 + 2 1/4 RDA 1 6 x 1 1 4 1 1/6 1 x 1 3

More information

10 (1) s 10.2 rails c Rails 7 > item = PlanItem.new => #<PlanItem id nil, name nil,...> > item.name = "" => "" > item.valid? => true valid? true false

10 (1) s 10.2 rails c Rails 7 > item = PlanItem.new => #<PlanItem id nil, name nil,...> > item.name =  =>  > item.valid? => true valid? true false 10 (1) 16 7 PicoPlanner validations 10.1 PicoPlanner Web Web invalid values validations Rails validates validate 107 10 (1) s 10.2 rails c Rails 7 > item = PlanItem.new => #

More information

ruby novice ruby novice ruby novice.

ruby novice ruby novice ruby novice. GitHub Ruby 2549 2017 3 1 1 3 2 4 2.1 ruby novice........................... 4 2.2.............................. 6 3 8 3.1 ruby novice....................... 8 3.2 ruby novice............................

More information

情報科学概論 第1回資料

情報科学概論 第1回資料 1. Excel (C) Hiroshi Pen Fujimori 1 2. (Excel) 2.1 Excel : 2.2Excel Excel (C) Hiroshi Pen Fujimori 2 256 (IV) :C (C 65536 B4 :2 (2 A3 Excel (C) Hiroshi Pen Fujimori 3 Tips: (1) B3 (2) (*1) (3) (4)Word

More information

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

I 1 1 ( *) ( *) ex1-1.rb ) 2 CGI

I 1 1 ( *) ( *) ex1-1.rb ) 2 CGI I 1 1 ( *) ( *) ex1-1.rb ) 2 CGI 1-1 http://klis.tsukuba.ac.jp/klib/subjects/progi/example2018/ 1-1 1-2 http://klis.tsukuba.ac.jp/klib/subjects/progi/example2018/ 1-2 I \( ) ( ) 1 3 Ruby 1 1? 1-3 ( ) I

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó 2 212 4 13 1 (4/6) : ruby 2 / 35 ( ) : gnuplot 3 / 35 ( ) 4 / 35 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 5 / 35 (mean): x = 1 n (median): { xr+1 m, m = 2r

More information

¥¢¥ë¥´¥ê¥º¥à¥¤¥ó¥È¥í¥À¥¯¥·¥ç¥ó ÎØ¹Ö #1

¥¢¥ë¥´¥ê¥º¥à¥¤¥ó¥È¥í¥À¥¯¥·¥ç¥ó ÎØ¹Ö #1 #1 id:motemen August 27, 2008 id:motemen 1-3 1-5 6-9 10-14 1 2 : n < a 1, a 2,..., a n > a 1 a 2 a n < a 1, a 2,..., a n > : Google: insertion sort site:youtube.com 1 : procedure Insertion-Sort(A) for

More information

r9.dvi

r9.dvi 2011 9 2011.12.9 Ruby B Web ( ) 1 1.1 2 def delete if at then return @cur = @prev.next = @cur.next (1) EOF (2)@cur 1 ()@prev 1 def exch if at @cur.next == @tail then return a = @prev; b = @cur.next; c

More information

Boost.Preprocessor でプログラミングしましょう DigitalGhost

Boost.Preprocessor でプログラミングしましょう DigitalGhost Boost.Preprocessor でプログラミングしましょう DigitalGhost http://d.hatena.ne.jp/digitalghost/ http://twitter.com/decimalbloat 私のこと hatena のプロフィールとか 見てください とりあえず FizzBuzz 書いてみた #define FIZZBUZZ_OP(z, n, d) \ FIZZBUZZ_OP_I(

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

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装 Ruby Scheme 2013-04-16 ( )! SICP *1 ;-) SchemeR SICP MIT * 1 Structure and Interpretaion of Computer Programs 2nd ed.: 2 i SchemeR Ruby Ruby Ruby Ruby & 3.0 Ruby ii https://github.com/ichusrlocalbin/scheme_in_ruby

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó 2 2015 4 20 1 (4/13) : ruby 2 / 49 2 ( ) : gnuplot 3 / 49 1 1 2014 6 IIJ / 4 / 49 1 ( ) / 5 / 49 ( ) 6 / 49 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 7 / 49

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

Microsoft PowerPoint - 13Kadai.pptx

Microsoft PowerPoint - 13Kadai.pptx 提出 講義での説明を聞いて下さい 櫻井彰人 コンパイラ理論課題 締め切りは 8 月 1 日とします 順不同で できるものをできるだけ多く回答して下さい 電子メールで sakurai あっと ae どっと keio どっと ac どっと jp に送ってください ファイル形式は pdf か MsWord で ただし プログラムはテキストファイルで レポート課題 1 それぞれ 1 問として考えます 電卓

More information

Emacs Ruby..

Emacs Ruby.. command line editor 27014533 2018 3 1 5 1.1................................... 5 1.2................................... 5 2 6 2.1 Emacs...................................... 6 2.2 Ruby.......................................

More information

javascript key

javascript key Associate Professor Department of International Social Studies KYOAI GAKUEN UNIVERSITY Email: ogashiwa@c.kyoai.ac.jp, ogashiwa@wide.ad.jp sample

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

Swift1.key

Swift1.key Swift Swift 対象読者としては すでにC 言語および Objective-C( あるいは少なくともJava など ) によるプログラミングの経験がある人を想定しています すでに出版されている入門書や雑誌記事ではSwiftの全体像が把握できないと感じている人には特にお勧めです ジェネリクスの機能や標準ライブラリに関する解説なども含んでおり 現時点では最も 濃い Swift 本になっていると思います

More information

Working Effectively with Legacy tdiary Code using Cucumber and RSpec KAKUTANI Shintaro; Eiwa System Management,Inc.; Nihon Ruby-no-kai pragprog.com Working Effectively with Legacy tdiary code using

More information

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

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 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

More information

5-2 print(i, "\n") print("-- while--\n") while i < 2 j = print(i, ",", j, "\n") print("-- while--\n") while j < 3 print(i, ",", j, "\n") j = j + 1 pri

5-2 print(i, \n) print(-- while--\n) while i < 2 j = print(i, ,, j, \n) print(-- while--\n) while j < 3 print(i, ,, j, \n) j = j + 1 pri I 5 1 5 2 2.1 5-1 print(i, "\n") print("-- while--\n") while i < 3 print(i, "\n") print("-- while--\n") print(i, "\n") 1 5-2 print(i, "\n") print("-- while--\n") while i < 2 j = print(i, ",", j, "\n")

More information

15 Phoenix HTML 15.1 ModestGreeter RAVT web/router.ex web/router.ex : 12 scope "/", ModestGreeter do 13 pipe_through :browser get "/", TopCont

15 Phoenix HTML 15.1 ModestGreeter RAVT web/router.ex web/router.ex : 12 scope /, ModestGreeter do 13 pipe_through :browser get /, TopCont 15 Phoenix HTML 15.1 ModestGreeter RAVT web/router.ex web/router.ex : 12 scope "/", ModestGreeter do 13 pipe_through :browser 14 15 + get "/", TopController, :index 16 get "/hello/:name", HelloController,

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

r2.dvi

r2.dvi 15 2 1 2015.6.2 ( ( ( Ruby ( ( https://www.ruby-lang.org/ja/documentation/ 2 Chris Pine,, 2,, 2010. Yugui, Ruby,, 2008. Ruby 1 ( Ruby ( 2 ( i i j ( ) /( (regular expression Ruby /.../ ( 1 if / / =~ =~

More information

2

2 問題 次の設問に答えよ 設問. Java のソースコードをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) javaw 設問. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d).jar 設問. Java のソースコードの拡張子はどれか a).c b).java c).class

More information

ohp1.dvi

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

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

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

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

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 (Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 17 Fortran Formular Tranlator Lapack Fortran FORTRAN, FORTRAN66, FORTRAN77, FORTRAN90, FORTRAN95 17.1 A Z ( ) 0 9, _, =, +, -, *,

More information

(Java/FX ) Java CD Java version Java VC++ Python Ruby Java Java Eclipse Java Java 3 Java for Everyone 2 10 Java Midi Java JavaFX Shape Canvas C

(Java/FX ) Java CD Java version Java VC++ Python Ruby Java Java Eclipse Java Java 3 Java for Everyone 2 10 Java Midi Java JavaFX Shape Canvas C (Java/FX ) Java CD Java version 10.0.1 Java VC++ Python Ruby Java Java Eclipse Java Java 3 Java for Everyone 2 10 Java Midi Java JavaFX Shape Canvas Canvas Eclipse Eclipse M... 1 javafx e(fx)clipse 3.0.0

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

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

() / (front end) (back end) (phase) (pass) 1 2

() / (front end) (back end) (phase) (pass) 1 2 1 () () lex http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 2018 4 1 () / (front end) (back end) (phase) (pass) 1 2 () () var left, right; fun int main() { left = 0; right = 10; return ((left

More information

2 3 Pockets Pockest Java [6] API (Backtracking) 2 [7] [8] [3] i == Pockets 2.1 C3PV web [9] Pockets [10]Pockets 1 3 C

2 3 Pockets Pockest Java [6] API (Backtracking) 2 [7] [8] [3] i == Pockets 2.1 C3PV web [9] Pockets [10]Pockets 1 3 C 1,a) 2 3 1 1 API Pockets Pockets Investigating the Model of Automatically Detecting Exploratory Programming Behaviors Erina Makihara 1,a) Hiroshi Igaki 2 Norihiro Yoshida 3 Kenji Fujiwara 1 Hajimu Iida

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

I 11

I 11 I 11 2 h 345 645 3 var strs = ["meijo", "university", "abc", "shiogama","yagoto", "ueda", "hara", "irinaka", "yagoto-nisseki", "kanayama"] function make_table(){ var a = [] for (var i = 0; i < strs.length;

More information

Microsoft PowerPoint - 11RubyIntro.ppt

Microsoft PowerPoint - 11RubyIntro.ppt プログラム言語論 (11) Ruby 入門 インストール その他 櫻井彰人 Ruby のインストールその 1 ActiveScriptRuby をインストールする http://arton.hp.infoseek.co.jp/indexj.html を参照のこと もっとも簡単 ただし administrator 権限が必要 ( 自分の PC なら OK) Ruby のインストールその 2 mswin32

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

2013-12-17.key

2013-12-17.key ! 13.3% 10% x! Web! Web! Web! Web! Web! Web! Web! Web! Web! SaaS SaaS SaaS require 'active_support/deprecation'! ActiveSupport::Deprecation.silenced = true

More information

Perl入学式 #3

Perl入学式 #3 Perl Entrance #3 参考資料 2012 年 3 月 18 日 Perl 入学式代表取り締まられ役 papix ( papix2011@gmail.com ) 1. 前回の復習 Sample Code use strict; use warnings; use utf8; binmode STDIN, ":utf8"; binmode STDOUT, ":utf8"; my $age;

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

haskell.gby

haskell.gby Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]

More information

ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1

ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1 More Logic More Types ML/OCaml GADT Jacques Garrigue ( ) Jacques Le Normand (Google) Didier Rémy (INRIA) @garriguejej ocamlgadt ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1 ( ) ML type nebou and

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

79!! 21

79!! 21 79!! 21 94 94 138 94 8 15 1 100 10 25 65 138 30 94 1 138 94 !! 1570 km 1.5 79 7 12 138 11 72 11 72 15 11 72 11 72 11 15 11 72 15 12 138 11 72 12 21 12 94 12 21 12 12 94 12 138 12 138 11 79 12 12 138

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション ループ ループとは? ある条件を満たすまで 指定の命令を繰り返す Do... Loop For Next For Each Next While WEnd ループの種類 Do Loop Do While 条件 ステートメント Loop Do ステートメント Loop While 条件 Do Until 条件 ステートメント Loop Do ステートメント Until Loop 条件 Do Loop

More information

Microsoft Word - hozon-fujimura-HP-伊勢工業高校における造船教育の歴史から学ぶ20160713

Microsoft Word - hozon-fujimura-HP-伊勢工業高校における造船教育の歴史から学ぶ20160713 1233 1 600 300 1578 1636 1800 Google 2 3 1853 1854 2000 1842 1848 300 1800 4 300 800 5 6 7 8 9 10 14 6 2 4 3 1 2 1 13 3 3 3 1 3 3 1 1 1 10 1 14 14 2 23 3 136 1 72 1 6 1 22 2 236 12 236 11 10% 7% 16% 17%

More information

/

/ / 1 UNIX AWK( ) 1.1 AWK AWK AWK A.V.Aho P.J.Weinberger B.W.Kernighan 3 UNIX AWK GNU AWK 1 1.2 1 mkdir ~/data data ( ) cd data 1 98 MS DOS FD 1 2 AWK 2.1 AWK 1 2 1 byte.data 1 byte.data 900 0 750 11 810

More information

listings-ext

listings-ext (6) Python (2) ( ) ohsaki@kwansei.ac.jp 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1

More information

JavaScript Web JavaScript BitArrow BitArrow ( 4 ) Web VBA JavaScript JavaScript JavaScript Web Ajax(Asynchronous JavaScript + XML) Web. JavaScr

JavaScript Web JavaScript BitArrow BitArrow ( 4 ) Web VBA JavaScript JavaScript JavaScript Web Ajax(Asynchronous JavaScript + XML) Web. JavaScr BitArrow JavaScript 1 2 2 3 4 JavaScript BitArrow 4 BitArrow BitArrow,, JavaScript,, Report of JavaScript Lessons on BitArrow, Online Programming Learning Environment Manabe Hiroki 1 Nagashima Kazuhei

More information

{:from => Java, :to => Ruby } Java Ruby KAKUTANI Shintaro; Eiwa System Management, Inc.; a strong Ruby proponent http://kakutani.com http://www.amazon.co.jp/o/asin/4873113202/kakutani-22 http://www.amazon.co.jp/o/asin/477413256x/kakutani-22

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

Python Speed Learning

Python   Speed Learning Python Speed Learning 1 / 76 Python 2 1 $ python 1 >>> 1 + 2 2 3 2 / 76 print : 1 print : ( ) 3 / 76 print : 1 print 1 2 print hello 3 print 1+2 4 print 7/3 5 print abs(-5*4) 4 / 76 print : 1 print 1 2

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

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

# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu

# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu II 4 : 2001 11 7 keywords: 1 OCaml OCaml (first-class value) (higher-order function) 1.1 1 2 + 2 2 + + n 2 sqsum 1 3 + 2 3 + + n 3 cbsum # let rec sqsum n = # if n = 0 then 0 else n * n + sqsum (n - 1)

More information

1Light Weight Language Light Weight Language Light Weight Language 5 2Perl Perl Perl PHP PHP PHP 34

1Light Weight Language Light Weight Language Light Weight Language 5 2Perl Perl Perl PHP PHP PHP 34 Ruby 1Light Weight Language 1 1.1 Light Weight Language 2 1.2 Light Weight Language 5 2Perl 11 2.1 Perl 12 2.2 Perl 15 2.3 20 3PHP 29 3.1 PHP 30 3.2 PHP 34 3.3 39 4Python 47 4.1 Python 48 4.2 Python 51

More information