/* MAIN PROGRAM */
main:- welcome.
welcome:-
write('************************************************'),nl,
write('* Welcome to my Simple Calculator *'),nl,
write('************************************************'),nl,nl,
write('For every input you enter, please followed by a full stop[.]'),
numbers.
numbers:-
nl,nl,write('First number: '),
read(FIRST),nl,
write('Second number: '),
read(SECOND),nl,
operation.
operation:-
nl,write('[1]- Addition.'), nl,
nl,write('[2]- Subtraction.'),nl,
nl,write('[3]- Multiplication.'),nl,
nl,write('[4]- Division.'),nl,
nl,write('[5]- Exit.'),nl,
nl,write(':>'),
read(ANS1),nl,
set_op(ANS1).
set_op(1):-
write(FIRST),write(SECOND),
SUM is FIRST + SECOND,
write(SUM).
我在做一个简单的计算器程序时遇到了麻烦。由于某种原因,它只会在被调用时传递变量的地址而不是值。如果有人能指出我的单据,我将不胜感激。谢谢你。