3_ada_syntax

3_ada_syntax - Introduction to Computers and Programming...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computers and Programming Lecture 3 General structure of Ada programs with ...; ---------------------------------- ---------------------------------- procedure program_name is declare constants & variables used begin statements end program_name; Prof. I. K. Lundqvist Reading: B pp. 217-228; FK pp. 65-111 Sept 9 2003 -- header -- program_name
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
General structure of Ada programs with Ada.Text_Io; procedure Hello_Name is --| Last Modified: June 1998 FirstName: String( 1 .. 10 ); begin Ada.Text_IO.Put (Item => ); Ada.Text_IO.New_Line; Ada.Text_IO.Put (Item => ); Ada.Text_IO.Put(Item => "Hello " ); Ada.Text_IO.Put(Item => ". Enjoy studying Ada!" ); Ada.Text_IO.New_Line; end Hello_Name; Modules ------------------------------------------------------------------- --| Requests, then displays, user's name --| Author: Michael Feldman, The George Washington University ------------------------------------------------------------------- -- object to hold user's name -- Hello_Name -- Prompt for (request user to enter) user's name "Enter your first name, exactly 10 letters." "Add spaces at the end if it's shorter.> " Ada.Text_IO.Get(Item => FirstName); -- Display the entered name, with a greeting Ada.Text_IO.Put(Item => FirstName); •P ro cedu re Abstracts an operation Package Collects related operations and data types Advantages of modules Procedures Functional abstraction Top-down development Reduced complexity Parallel development Avoid duplication Packages
Background image of page 2
Procedure "ADA" in giant letters would be written as a monolithic program. Then we look at it when it is broken into procedures.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

3_ada_syntax - Introduction to Computers and Programming...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online