From: comicfanzine@gmail.com
Subject: Simple call of Procedure in package from a main program
Date: Sat, 31 Oct 2015 05:53:31 -0700 (PDT)
Date: 2015-10-31T05:53:31-07:00 [thread overview]
Message-ID: <4d618dd3-3bc1-4afc-8e74-78aca76b0b09@googlegroups.com> (raw)
Hello everyone ,
I have a simple main program , who call a procedure in a package but it not compile . In total , i have 3 files(1 main program , 1 packagefile.adb , and , 1 packagefile.ads) :
user_or_admin.adb(main program) :
[code]with ada.text_io ; use ada.text_io ;
with identification; use identification;
Procedure User_or_admin is
begin
New_Line ;
Put_line("Hello user, what's your name");
yes_or_no;
if Password = "admin"
then Put_Line("Welcome administrator");
end if; end User_or_admin ;
[/code=ada]
identification.adb(packagefile)
[code]with ada.text_io ; use ada.text_io ;
package identification is
Procedure yes_or_no is
Password : String(1..5) ;
Begin
declare
name : String := ada.text_io.get_line ;
begin
if name = "fanzine"
then Put("what is the password : ") ;
Get(Password) ; New_Line ; Skip_line ;
elsif name /= "fanzine"
then Put_line("You're not administrator") ;
end if;
end ;
end yes_or_no;
end identification;[/code=ada]
identification.ads(packagefile)
[code]package identification is
Procedure yes_or_no (Password : String );
end identification;[/code=ada]
If you stil don't understand what i want to do after reading the files , i explain :
In the main program , after Put_line i want to have the procedure in the packagefile be executed , so after the Hello[...] : do the get_line which is in the packagefile and do the "if-then" condition after it , and finaly if this "if-then" condition is valid , do the Password condition .
Don't hesitate to correct the files if you think what i want to do correspond what you doing .
Thanks for you time , it is always a pleasure to code in Ada and have the help of others ada programers .
next reply other threads:[~2015-10-31 12:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-31 12:53 comicfanzine [this message]
2015-10-31 15:52 ` Simple call of Procedure in package from a main program mockturtle
2015-10-31 17:32 ` comicfanzine
2015-10-31 17:54 ` Jeffrey R. Carter
2015-11-01 10:50 ` comicfanzine
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox