All right, while I was sitting in class today I wrote my first Ada program on paper and compiled it when I got back to my dorm. Pretty simple (and obnoxious), but I think I've got the formatting/syntax down, at least for text I/O.
WITH Ada.Text_IO;
PROCEDURE Hello IS
Name : String(1..4);
BEGIN --Hello
Ada.Text_IO.Put(Item => "Enter your name:");
Ada.Text_IO.Get(Item => Name);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item => "Hello, ");
Ada.Text_IO.Put(Item => Name);
Ada.Text_IO.Put(Item => "!");
END Hello;
This program, of course, takes a name and greets them. At least, only if the user has a four-letter name. This of course means that I'll need to dynamically allocate the contents of the array in memory.
Edit: I like how that last sentence really makes it obvious that English is not my first language. Which it is.
Friday, September 28, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment