with ada.text_io; use ada.text_io;
procedure group3orig is
Maxwordsize: constant Natural := 100;
Maxwordlistsize: constant Natural := 100;
-- Let's define a type for arrays
-- This does not create any instances of the array
type WordList is array (1 .. Maxwordlistsize) of string(1 .. Maxwordsize);
type WordLengthList is array (1 .. Maxwordlistsize) of Natural;
procedure addWord(w: in String;
wl:in out WordList;
wll:in out WordLengthList;
n: in out Natural) is
begin
n := n + 1;
wl(n) := w;
end addWord;
-- Now declare an instance of the array
-- Remember that the type declaration does not create an instance of the type
theWordList: wordList;
theWordLengthList: wordLengthList;
theWord: String(1 .. Maxwordsize);
NumEntered: Natural := 0;
-- Let's do some bottom up testing of addWord
begin
theWord(1..9) := ("Firstword");
addWord(theWord, theWordList, theWordLengthList, NumEntered);
theWord(1..10) := ("secondword");
addWord(theWord, theWordList, theWordLengthList, NumEntered);
for i in 1 .. NumEntered loop
put_line( theWordList(i) );
end loop;
end group3orig;