Thanks Jafar,
I had to laugh as it was an error between keyboard and seat. I forget
the difference between move() and tab().
By the way, the output you requested was at the end of the original
question.
Thanks for your quick reply.
regards
Bruce Rennie
On 11/03/13 02:42, Jafar Al-Gharaibeh wrote:
Bruce,
After looking at your program and trying to refresh my memory in
string scanning functions, I believe your problem is using move() in
place of tab(). After doing that change, your program run
to completion with no issues on m sides.
Cheers,
Jafar
On Sun, Mar 10, 2013 at 9:09 AM, Bruce & Breeanna Rennie
<bren...@dcsi.net.au <mailto:bren...@dcsi.net.au>> wrote:
Good morning to all,
I have the following unicon program
procedure main()
local inp, outp, line, trials, credit, items, itemsl, itemol,
i, j, cnt, eli, p1, p2, el2, trace
inp := open("sc.txt", "rt")
outp := open("scr.txt", "w")
trace := open("trace.txt", "w")
itemol := list()
itemsl := list()
items := set()
trials := read(inp) + 0
write(trace, "$", trials, "$")
every i := 1 to trials do {
credit := read(inp) + 0
write(trace, "credit:", credit)
cnt := read(inp) + 0
write(trace, "cnt:", cnt)
j := 1
write(trace, line := read(inp)) ? while j <= cnt do {
write(trace, "j:", j)
write(trace, "&subject:", &subject)
write(trace, "&pos:", &pos)
move(many(" "))
write(trace, "&pos:", &pos)
write(trace, "#", &digits, "#")
(eli := move(many(&digits))) #
<==== problem line
write(trace, "&pos:", &pos)
write(trace, eli)
insert(items, credit >= eli)
itemol := put(itemol, eli)
itemsl := put(itemsl, credit >= eli)
j +:= 1
}
itemsl := sort(itemsl)
while /p1 | /p2 do {
eli := pop(itemsl)
el2 := credit - eli
if member(items, el2) then
every j := 1 to cnt do {
/p1 := (itemol[j] = eli) & j
p2 := (itemol[j] = el2) & j
}
}
write(outp, "case #", i, (p1 > p2) | p1 ,(p1 <= p2) | p1)
}
end
which is giving the following error
Run-time error 102
File storecredit.icn; Line 27
numeric expected
offending value: "75 25"
Traceback:
main()
{100 >= "75 25"} from line 27 in storecredit.icn
The data file being used is attached as well as the trace file
created during the program run. Is there an error between keyboard
and chair or is it in the function many(). I expected that the
value being returned back from the line marked above should have
been "75". What I did notice was that the first time through, the
value of &pos was expected to be 2 but was 3 instead.
I am running 32 bit linux Fedora 17 on a Toshiba NB500
netbook.with the following Unicon version
unicon -version
Unicon Version 12.1. November 19, 2012
regards
Bruce Rennie
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The
Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice"
in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
<mailto:Unicon-group@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/unicon-group
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group