09/07/17 03:28:41
>>488
% Prolog
数当てゲーム :-
repeat,
_a is ramdom mod 10 + 1,
write('好きな数字を入力してください '),
get_line(Line),
atom_to_term(Line,N,_),
数当てゲーム診断(_a,N),
Line = end_of_file.
数当てゲーム診断(A,A) :-
write('あたり!!\n').
数当てゲーム診断(_,B) :-
not(integer(B)),
write('入力されたのは整数ではありません\n').
数当てゲーム診断(A,N) :-
not(A == N),
write_formatted('残念乱数は%tです\n',[A]).