comp.lang.ada
 help / color / mirror / Atom feed
* raised Constraint_Error?
@ 1995-04-03  0:00 Jeff Winchester
  1995-04-03  0:00 ` Michael Feldman
  1995-04-04  0:00 ` Kevin F. Quinn
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Winchester @ 1995-04-03  0:00 UTC (permalink / 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         |
\--------------------------------------------------------/





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-04-04  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-04-03  0:00 raised Constraint_Error? Jeff Winchester
1995-04-03  0:00 ` Michael Feldman
1995-04-03  0:00   ` Jeff Winchester
1995-04-04  0:00 ` Kevin F. Quinn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox