comp.lang.ada
 help / color / mirror / Atom feed
* Re: Could you help me debug this please?
  1999-05-25  0:00 Could you help me debug this please? Aaron
  1999-05-25  0:00 ` Fernand0
@ 1999-05-25  0:00 ` Robert Dewar
  1999-05-27  0:00 ` Shawn M. Root
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1999-05-25  0:00 UTC (permalink / raw)


In article <374a318b.1942660@news.ozemail.com.au>,
  rum_and_cola@hotmail.com (Aaron) wrote:
> I keep getting the error mesage  "Statemnt Expected" in line
73
> whenever I try compiling this program. If anyone could help
me, I'd be
> greatful.
>
> with Text_Io;
> procedure Assessment2 is
>
>    --types and packages
>    type Choice is
>       (Migrate, Previous, Stop);
>    package Choice_Io is new
>       Text_Io.Enumeration_Io
>       (Enum => Choice);
>
>    --variables
>    Code: Choice;
> in_data : text_io.file_type;
> filename, degree, migrantname, YOB, money: string (1..20);
> last: natural;
>
>    --functions
>    procedure Get_The_Action;
> --gets the input from the keyboard for the main menu
> procedure write_data
> (in_data : in out text_io.file_type);
> -- procedure to get the names of people and store them.
>
>    procedure Get_The_Action is
>    begin
>    Text_Io.Put("Migration Program:");
>    Text_Io.New_Line;
>    Text_Io.Put("Enter 'Migrate' to store migrants details on
file.");
>    Text_Io.New_Line;
>    Text_Io.Put("Enter 'Previous' to read and display
information about
> migrants.");
>    Text_Io.New_Line;
>    Text_Io.Put("Enter 'Finish' to quit.");
>    Text_Io.New_Line;
>    Choice_Io.Get(Code);
> end Get_The_Action;
>
> procedure write_data
> (in_data : in out text_io.file_type) is
> begin
>    text_io.put("Migrants Name:");
> text_io.get_line(migrantname, last);
> text_io.put(file=>In_data,
>    item=> migrantname);
> text_io.new_line(file =>in_data);
>    text_io.put("Degree in computing (Y/N):");
> text_io.get_line(degree, last);
>    text_io.put(file=>In_data,
>    item=> degree);
>    text_io.new_line(file =>in_data);
>    text_io.put("Year of Birth:");
>    text_io.get_line(YOB, last);
>    text_io.put(file=>In_data,
>    item=> YOB);
> text_io.new_line(file =>in_data);
> text_io.put("Amount of Money:");
>    text_io.get_line(money, last);
>    text_io.put(file=>In_data,
>    item=> money);
>    text_io.new_line(file =>in_data);
> Text_Io.Put("Enter the file name and path: ");
>    Text_Io.Get_line(filename, last);
>    Text_Io.create (File=>In_Data,
>       Mode=>Text_Io.out_File, Name=>filename);
>    write_Data(In_Data);
>    Text_Io.Close(In_Data);
> end write_data;
>
> begin
> get_the_action;
> if (Code=previous) then
> text_Io.Put("Not written yet ");
> elsif (Code=migrate) then
> (write_data(in_data : out text_io.file_type));
> else
> text_io.put("ok");
> end if;
> text_io.put("Goodbye");
> end assessment2;
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---




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

* Could you help me debug this please?
@ 1999-05-25  0:00 Aaron
  1999-05-25  0:00 ` Fernand0
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aaron @ 1999-05-25  0:00 UTC (permalink / raw)


I keep getting the error mesage  "Statemnt Expected" in line 73
whenever I try compiling this program. If anyone could help me, I'd be
greatful.

with Text_Io;
procedure Assessment2 is

   --types and packages
   type Choice is
      (Migrate, Previous, Stop);
   package Choice_Io is new
      Text_Io.Enumeration_Io
      (Enum => Choice);

   --variables   
   Code: Choice;
in_data : text_io.file_type;
filename, degree, migrantname, YOB, money: string (1..20);
last: natural;

   --functions
   procedure Get_The_Action;
--gets the input from the keyboard for the main menu
procedure write_data
(in_data : in out text_io.file_type);
-- procedure to get the names of people and store them.

   procedure Get_The_Action is
   begin
   Text_Io.Put("Migration Program:");
   Text_Io.New_Line;
   Text_Io.Put("Enter 'Migrate' to store migrants details on file.");
   Text_Io.New_Line;
   Text_Io.Put("Enter 'Previous' to read and display information about
migrants.");
   Text_Io.New_Line;
   Text_Io.Put("Enter 'Finish' to quit.");
   Text_Io.New_Line;
   Choice_Io.Get(Code);
end Get_The_Action;

procedure write_data
(in_data : in out text_io.file_type) is
begin
   text_io.put("Migrants Name:");
text_io.get_line(migrantname, last);
text_io.put(file=>In_data,
   item=> migrantname);
text_io.new_line(file =>in_data);
   text_io.put("Degree in computing (Y/N):");
text_io.get_line(degree, last);
   text_io.put(file=>In_data,
   item=> degree);
   text_io.new_line(file =>in_data);
   text_io.put("Year of Birth:");
   text_io.get_line(YOB, last);
   text_io.put(file=>In_data,
   item=> YOB);
text_io.new_line(file =>in_data);
text_io.put("Amount of Money:");
   text_io.get_line(money, last);
   text_io.put(file=>In_data,
   item=> money);
   text_io.new_line(file =>in_data);
Text_Io.Put("Enter the file name and path: ");
   Text_Io.Get_line(filename, last);
   Text_Io.create (File=>In_Data,
      Mode=>Text_Io.out_File, Name=>filename);
   write_Data(In_Data);
   Text_Io.Close(In_Data);
end write_data;

begin
get_the_action;
if (Code=previous) then
text_Io.Put("Not written yet ");
elsif (Code=migrate) then
(write_data(in_data : out text_io.file_type));
else
text_io.put("ok");
end if;
text_io.put("Goodbye");
end assessment2;




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

* Re: Could you help me debug this please?
  1999-05-25  0:00 Could you help me debug this please? Aaron
@ 1999-05-25  0:00 ` Fernand0
  1999-05-25  0:00 ` Robert Dewar
  1999-05-27  0:00 ` Shawn M. Root
  2 siblings, 0 replies; 4+ messages in thread
From: Fernand0 @ 1999-05-25  0:00 UTC (permalink / raw)


Hi,


>elsif (Code=migrate) then
>(write_data(in_data : out text_io.file_type));
                     ^^^^^^^^^^^^^^^^^^^^^^^

probably the compiler gets confused with a declaration of a parameter in
the call?? Try deleting the declaration part and substituting it by an 
actual call.

Best regards,

Fernando Tricas





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

* Re: Could you help me debug this please?
  1999-05-25  0:00 Could you help me debug this please? Aaron
  1999-05-25  0:00 ` Fernand0
  1999-05-25  0:00 ` Robert Dewar
@ 1999-05-27  0:00 ` Shawn M. Root
  2 siblings, 0 replies; 4+ messages in thread
From: Shawn M. Root @ 1999-05-27  0:00 UTC (permalink / raw)



Aaron wrote in message <374a318b.1942660@news.ozemail.com.au>...
:I keep getting the error mesage  "Statemnt Expected" in line 73
:whenever I try compiling this program. If anyone could help me, I'd be
:greatful.
:


<snip most of code>


:elsif (Code=migrate) then
:(write_data(in_data : out text_io.file_type));

  ^-----------------------------------------^

The above is the form for a procedure specification (or nearly so) not
a call to that procedure.  You should replace "in_data : out
text_io.file_type" with the name a variable of type text_io.file_type
that you wish to pass to this procedure.  Additionally, the outer
parentheses around the call to write_data should be removed.  For
example:

if you have a variable declared as
In_File : Text_Io.File_Type;

then the above two lines of code would look like

elsif (Code=migrate) then
write_data(In_Data => In_File);


If this is an assignment for a class, you should really go see your
instructor for additional help.  There are other errors lurking in your
code that will trip you up later. Good luck.

<snip to end>

--
Shawn M. Root







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

end of thread, other threads:[~1999-05-27  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-25  0:00 Could you help me debug this please? Aaron
1999-05-25  0:00 ` Fernand0
1999-05-25  0:00 ` Robert Dewar
1999-05-27  0:00 ` Shawn M. Root

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