basic I/O
From: Lura (rroditi_at_bezeqint.net)
Date: 04/07/04
- Next message: bart demoen: "Re: basic I/O"
- Previous message: Stephan Lehmke: "Re: newbie question: recursion algorithm and iterative algorithm"
- Next in thread: bart demoen: "Re: basic I/O"
- Reply: bart demoen: "Re: basic I/O"
- Reply: Matthew Purver: "Re: basic I/O"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Apr 2004 11:05:24 -0700
Hello!
I start to learn I/O in prolog.
I have SWI prolog compiler.
I try the following program to get number from user and output cube:
cube :-
write('next item: '),
read(X),
process(X).
process(stop) :- !.
process(N) :-
C is N * N * N,
write('cube of '),write(N),write(' is '),
write(C),nl,
cube.
but when i try it i can't accept result. every time i'am in first 'read'.
?- cube.
next item: 2
|: 3
|: 3
thanks
- Next message: bart demoen: "Re: basic I/O"
- Previous message: Stephan Lehmke: "Re: newbie question: recursion algorithm and iterative algorithm"
- Next in thread: bart demoen: "Re: basic I/O"
- Reply: bart demoen: "Re: basic I/O"
- Reply: Matthew Purver: "Re: basic I/O"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]