comp.lang.ada
 help / color / mirror / Atom feed
From: "David Freshwater" <dafresh@cyllene.uwa.edu.au>
Subject: Exit Loop_Statement
Date: 2000/05/09
Date: 2000-05-09T00:00:00+00:00	[thread overview]
Message-ID: <8f7oep$khc$1@enyo.uwa.edu.au> (raw)

Hi All,
         Just a quick question about Exiting a loop. I have an assignment
where I have to Exit when "Stop" is input as a clients name, which I can do.
The problem is that it has to be case insensitive. Also I am trying to get
the exception statement in the Procedure to work to work The Procedure is as
follows :
--+++++++Buy Procedures+++++++--

             --Gets user input and calls on save_data to store

procedure Buy is

begin


    I := 0; --Initialize i
    Nof := 0; --Initialize NOF

    New_Line;
    Put("Please enter the name of the file you wish to create : ");
    Get_Line(Item => Filename, Last => P_L_C_I_F);
    New_Line;


   Any_File :
      Loop

           Put("Please enter the clients name : ");
          Get_Line(Item => Any (I + 1).Clients, Last => P_L_C);
          Put("Olympic Sponsor? (Enter True or False) : ");
          Boolean_Io.Get(Sponsor);
          exit Any_File when Any(I+1).Clients(1..3) = "Stop";
          I := I + 1;  --Increment counter if name<> STOP

          Skip_Line;
          Put("Please enter the number of tickets purchased : ");
          Integer_Io.Get(Item => Any (I + 1).Num_Tickets);
          Put("Please enter the total cost of purchase : $");
          Float_Io.Get(Item => Any (I + 1).Cost_Total);
          New_Line(3);
          Skip_Line;


    end loop Any_File;

    exception

   when DATA_ERROR|NUMERIC_ERROR =>


     Put_Line("                  *****************************");
     New_Line;
     Put_Line("                  *   INCORRECT DATA ENTRY !  *");
     New_Line;
     Put_Line("                  *  Please re-enter the data *");
     New_Line;
     Put_Line("                  *****************************");
     Skip_Line;
     New_Line (2);


   Save_Data(I, Filename, P_L_C_I_F);

end Buy;

Any help or suggestions would be greatly appreciated.

David






             reply	other threads:[~2000-05-09  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-09  0:00 David Freshwater [this message]
2000-05-09  0:00 ` Exit Loop_Statement Ken Garlington
2000-05-09  0:00 ` Gautier
2000-05-09  0:00   ` Robert Dewar
2000-05-09  0:00 ` John English
2000-05-09  0:00   ` Robert Dewar
2000-05-09  0:00     ` David Freshwater
2000-05-09  0:00       ` DuckE
2000-05-09  0:00     ` John English
2000-05-09  0:00       ` John English
2000-05-09  0:00         ` Robert Dewar
2000-05-10  0:00 ` Jeff Creem
2000-05-10  0:00   ` Robert A Duff
replies disabled

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