2011年10月13日 unix的FizzBuzz
■[FizzBuzz][Dart]Dart言語で99 bottles of beer
Dart言語で手探りながら99 bottles of beerを書いた。
Dart: Structured web apps | DartLang.org
99 Bottles of Beer | Start
class Bottle {
var b1 = 'bottle' ;
var b2 = 'bottles' ;
number(n) {
return (n==1)? b1 : b2 ;
}
}
class BoB {
number(n,lq) {
var bottle = new Bottle() ;
int nn = n - 1 ;
String bn = bottle.number(n) ;
String bnn = bottle.number(nn) ;
switch(n) {
case 0:
print('No more $bn of $lq on the wall, no more $bn of $lq.') ;
break ;
case 1:
print('1 $bn of $lq on the wall, 1 $bn of $lq.');
break ;
default:
print('$n $bn of $lq on the wall, $n $bn of $lq.');
print('Take one down and pass it around, $nn $bnn of $lq on the wall.');
}
}
}
main() {
var bob = new BoB() ;
for (int b = 99; b >= 0; b--) {
bob.number(b,'beer');
}
}
トラックバック - http://d.hatena.ne.jp/houmei/20111013/1318484038
リンク元
- 2 http://bit.ly/mUrY0r
- 2 http://search.goo.ne.jp/web.jsp?MT=WHS2011 設定&web=検索&from=kanagawa-east&IE=sjis
- 2 http://www.google.co.jp/search?hl=ja&source=hp&q=hp+15c+limited+edition&oq=HP+15C&aq=1&aqi=g10&aql=&gs_sm=c&gs_upl=1672l8657l0l13094l11l11l5l0l0l0l187l828l2.4l6l0
- 1 http://bit.ly/rlFc1O
- 1 http://d.hatena.ne.jp/keyword/C++
- 1 http://k.hatena.ne.jp/keywordblog/Windows Home Server
- 1 http://t.co/t2efTIYU
- 1 http://t.co/vzG9z6cg
- 1 http://www.google.co.jp/search?num=100&hl=ja&rlz=1B3GGLL_jaJP403JP403&q=ProLiant+MicroServer+Windows+Home+Server+2011&oq=ProLiant+MicroServer+Windows+Home+Server+2011&aq=f&aqi=g-m1&aql=1&gs_sm=e&gs_upl=2375l3250l0l3565l5l5l0l0l0l0l222l751l1.3.1l5l0
- 1 http://www.google.co.jp/search?q=ファイルサーバ+家庭+2011&rls=com.microsoft:ja:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7SUNC_jaJP355&redir_esc=&ei=oteWTrygB6-JmQWEsPGUAg
