→ jkdncv:呃阿~~本來也想用這個語言來大混戰的 沒想到還是被用了 10/14 18:06
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.50.40.140
※ 編輯: kenzou 來自: 123.50.40.140 (10/14 14:55)
補上swi-prolog的版本。
#!/usr/bin/env swipl
topound :-
write('please input your weight: '),
read(Weight),
calc(Weight).
calc(stop) :-
!.
calc(Weight) :-
Pound is Weight / 0.454,
write('your weight is ' + Pound + 'pound\n'),
topound.
:-
topound.
--