From: Jeff Winchester <winchest@csee.usf.edu>
Subject: raised Constraint_Error?
Date: 1995/04/03
Date: 1995-04-03T00:00:00+00:00 [thread overview]
Message-ID: <Pine.SUN.3.91.950403111430.12054B-100000@babbage> (raw)
Could anyone tell me why the following code would cause a constraint
error? I've been pulling out hairs for a couple of days now and am
obviously overlooking something simple. Thanks.
current := head;
while current /= null loop
if (current.name (current.nl)) = (sname (snl)) then
current := current.next;
if (current.class (current.cl)) = (sclass (scl)) then
current := current.next;
if (current.number = snumber) then
current := current.next;
pay := current.cost;
text_io.put ("The test costs $");
flt_io.put (item => current.cost, aft => 2, exp => 0);
text_io.put ("Please enter your payment --> $");
flt_io.get (pay);
text_io.new_line;
if pay < cost then
pcost := cost - pay;
text_io.put ("You didn't pay enough. You still owe $");
flt_io.put (item => pcost, aft => 2, exp => 0);
elsif cost < pay then
pcost := pay - cost;
text_io.put ("Thank you. Your change is $");
flt_io.put (item => pcost, aft => 2, exp => 0);
else current := current.next;
end if;
else current := current.next;
end if;
else current := current.next;
end if;
else current := current.next;
end if;
exit when current = null;
end loop;
end price;
-------------------- or this one. . . .
if lthis = 1 then
text_io.new_line;
text_io.put ("Please enter the class name --> ");
text_io.get_line (lclass, lcl);
text_io.skip_line;
lcurrent := head;
while lcurrent /= null loop
if (lcurrent.class (lcurrent.cl)) = (lclass (lcl)) then
text_io.put_line (lcurrent.name (1..lcurrent.nl));
text_io.put_line (lcurrent.class (1..lcurrent.cl));
int_io.put (lcurrent.number);
text_io.new_line;
int_io.put (lcurrent.quantity);
text_io.new_line;
flt_io.put (lcurrent.cost);
text_io.new_line;
int_io.put (lcurrent.pages);
text_io.new_line;
text_io.new_line;
lcurrent := lcurrent.next;
else lcurrent := lcurrent.next;
end if;
end loop;
Very simple variable definitions--either string (1..35), integer, or
float. That's not the problem, however. The linked lists seem to cause
constrainst errors when searched, and I'm not sure why. any help would
be appreciated--this is a last ditch effort for a programming class. Thanks.
/--------------------------------------------------------\
| Jeff Winchester | PD Playhouse BBS | FidoNet 1:3635/40 |
| [Team OS/2] | (813) 422-7391 | RGSNet 50:270/504 |
|------------------------------------| EX-Net 80:200/10 |
| Catering to the support of OS/2 | ITCNet 88:881/518 |
| and the Renegade BBS software | |
|--------------------------------------------------------|
| CompuServe: 73404,2160 America Online: JeffW13680 |
| Internet: winchest@babbage.csee.usf.edu |
\--------------------------------------------------------/
next reply other threads:[~1995-04-03 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-04-03 0:00 Jeff Winchester [this message]
1995-04-03 0:00 ` raised Constraint_Error? Michael Feldman
1995-04-03 0:00 ` Jeff Winchester
1995-04-04 0:00 ` Kevin F. Quinn
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox