Please help me I have no idea what is prolog about and I need to solve this problem - probably very easy for most of you.
I need to transform numbers to words, but not only digits but also teens and tens up to millions. If you can help me, I would really appreciate it. I need it in different language so I canno´t use phrase.
full_words(0) :- !, write(zero), nl.
full_words(N) :- integer(N), N > 0, full_words1(N), nl.
full_words1(0) :- !.
full_words1(N) :- N > 0,
Q is N // 10, R is N mod 10,
full_words1(Q), numberword(R,RW), hyphen(Q), write(RW).
hyphen(0) :- !.
hyphen(Q) :- Q > 0, write('-').
numberword(0,zero).
numberword(1,one).
numberword(2,two).
numberword(3,three).
numberword(4,four).
numberword(5,five).
numberword(6,six).
numberword(7,seven).
numberword(8,eight).
numberword(9,nine).
I need to transform numbers to words, but not only digits but also teens and tens up to millions. If you can help me, I would really appreciate it. I need it in different language so I canno´t use phrase.
full_words(0) :- !, write(zero), nl.
full_words(N) :- integer(N), N > 0, full_words1(N), nl.
full_words1(0) :- !.
full_words1(N) :- N > 0,
Q is N // 10, R is N mod 10,
full_words1(Q), numberword(R,RW), hyphen(Q), write(RW).
hyphen(0) :- !.
hyphen(Q) :- Q > 0, write('-').
numberword(0,zero).
numberword(1,one).
numberword(2,two).
numberword(3,three).
numberword(4,four).
numberword(5,five).
numberword(6,six).
numberword(7,seven).
numberword(8,eight).
numberword(9,nine).