comp.lang.ada
 help / color / mirror / Atom feed
* Why wont this work
@ 1998-02-02  0:00 SiliconJesus
  1998-02-03  0:00 ` Why won't " John Herro
  0 siblings, 1 reply; 2+ messages in thread
From: SiliconJesus @ 1998-02-02  0:00 UTC (permalink / raw)



----------------------------------------------------
--
--I want this to kill if the user enters 4 oh's-
--Procedure for entering in the data it's an array of records
---------------------------------------
    
  WHILE Ide /= "OOOO" LOOP

    I:=I +1;
    Ada.Text_IO.PUT(Item =>"Please enter the Article Id");
    Ada.Text_IO.Get_Line(Item =>Ide, Last =>how_long); 
    Data(I).Id:=Ide;   
    Ada.Text_IO.Skip_Line;
    Ada.Text_IO.PUT_Line(Item =>"Please enter article description");
    Ada.Text_IO.Get_Line(Item =>art_d, Last =>how_long);
    Data(I).desc:=art_d;
    Ada.Text_IO.Skip_Line;
    Ada.Text_IO.PUT_Line(Item =>"Please enter number in stock");
    Ada.Integer_Text_IO.Get(Item =>temp);
    Ada.Text_IO.Skip_Line;
    Data(I).Num:=temp;
    Ada.Text_IO.PUT_Line(Item =>"Please enter price");
    Ada.Float_Text_IO.Get(Item =>temp2);
    Data(I).Value:=temp2;
    
END LOOP;
END Enter;
----------------------------------------------------

		
				,.   '\'\    ,---.
				| \\  l\\l_ //    |     ~NARF!!
				|  \\/ `/  `.|    |      
				| Y |   |   ||  Y |      
				|  \|   |   |\ /  |      
				\   |  o|o  | >  /       
				 \___\_--_ /_/__/        
				 /.-\(____) /--.\        
				 `--(______)----'
				     U// U / \
				     / \  / /|           		   
==========================================================================
|    John M. Softich                | " I wanna live, I wanna love       |
|  softichj@cs.montana.edu          |      but it's a long hard          |
|  Montana State University         |       road out of hell! "          |
|  Http://cs.montana.edu/~softichj  |                ~Manson             |
==========================================================================





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

* Re: Why won't this work
  1998-02-02  0:00 Why wont this work SiliconJesus
@ 1998-02-03  0:00 ` John Herro
  0 siblings, 0 replies; 2+ messages in thread
From: John Herro @ 1998-02-03  0:00 UTC (permalink / raw)



SiliconJesus <softichj@cs.montana.edu> writes:
>--I want this to kill if the user enters 4 oh's- ...
>WHILE Ide /= "OOOO" LOOP ...
>      Ada.Text_IO.PUT(Item =>"Please enter the Article Id");           >     
>      Ada.Text_IO.Get_Line(Item =>Ide, Last =>how_long); 

You're comparing "OOOO" with the whole string Ide instead of just the portion
of the string that the user typed.  Change the WHILE to

WHILE Ide(1 .. how_long) /= "OOOO" LOOP

and make sure how_long is initialized before the first pass through the loop
(perhaps by setting it to 0 in its declaration).
- John Herro
Download the Ada Tutor program at:
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




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

end of thread, other threads:[~1998-02-03  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-02  0:00 Why wont this work SiliconJesus
1998-02-03  0:00 ` Why won't " John Herro

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