comp.lang.ada
 help / color / mirror / Atom feed
From: irons@my-deja.com
Subject: how to make a record work??? any help would be greatly appreciated
Date: 1999/09/14
Date: 1999-09-14T00:00:00+00:00	[thread overview]
Message-ID: <7rm3n8$to1$1@nnrp1.deja.com> (raw)

Hi

i'm getting a lot of errors and have a hard time in general trying to
make this simple program to work ..here's the code:

(the questions are written after the code)


with ada.text_io,ada.integer_text_io;
use ada.text_io,ada.integer_text_io;

procedure countries is


country_number:integer:=6;

   type a is array (1..6) of integer;
   type country is (syria,iran,turkey,egypt,jordan,saudi_arabia);
   type neighbouring_country is
       record
            country_name:string(1..2);
            syria_neighbour:string(1..1);
            iran_neighbor:string(1..1);
            turkey_neighbour:string(1..1);
            egypt_neighbour:string(1..1);
            jordan_neighbour:string(1..1);
            saudi_arabia_neighbour:string(1..1);
       end record;
    type my_country is array (1..6) of neighbouring_country;
    a(i):=my_country(i);

    begin

    for i in 1..6 loop
    get (my_country(i).neighbouring_country);
    put (my_country(i).country_name);
    get (my_country(i).syria_neighbour);
    put (my_country(i).syria_neighbour);
    get (my_country(i).iran_neighbor);
    put (my_country(i).iran_neighbor);
    get (my_country(i).turkey_neighbour);
    put (my_country(i).turkey_neighbour);
    get (my_country(i).egypt_neighbour);
    put (my_country(i).egypt_neighbour);
    get (my_country(i).jordan_neighbour);
    put (my_country(i).jordan_neighbour);
    get (my_country(i).saudi_arabia_neighbour);
    put (my_country(i).saudi_arabia_neighbour);
    new_line;
    end loop;

end countries;



the line "a(i):=my_country(i);" and everything inside the loop is not
working ...i'm trying to make a program that allows the user to input
the country prefix and if that country touchs other countries... for
example i'm trying to make the table look like this:

(this table just lists the country and if it touchs a neighbouring
country)

-----------------------------------------------------
contries|syria|iran|turkey|egypt|jordan|saudi_arabia|
-----------------------------------------------------
syria   | --  | no | yes  | no  | yes  |     no     |
-----------------------------------------------------
iran    | no  | -- | yes  | no  | no   |     no     |
-----------------------------------------------------
turkey  | yes | yes|  --  | no  | no   |     no     |
-----------------------------------------------------
egypt   | no  | no |  no  | --  | yes  |     no     |
-----------------------------------------------------
jordan  | yes | no |  no  | yes | --   |     yes    |
-----------------------------------------------------
saudi_ar| no  | no |  no  | no  | yes  |     --     |
-----------------------------------------------------

input would be: sy,--,no, yes,no yes,no (this is for syria) then i
would do the same all the way down to saudi_arabia .
for example: saudi_arabia's input would be it's prefix and it's if it
touchs another country or not
input: sa,no,no,no,yes,--

i know this looks like a lot ...any suggestions on how to make this
program work would be of great value to me and would be greatly
appreciated

my e-mail: okdeh@zebra.net







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




             reply	other threads:[~1999-09-14  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-14  0:00 irons [this message]
1999-09-14  0:00 ` how to make a record work??? any help would be greatly appreciated tmoran
replies disabled

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