c09_ps04_sol

c09_ps04_sol - C9-1 Algorithm Package Specification...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: C9-1 Algorithm Package Specification 1.Declare the type. 2.Create a new package within the package specification to provide predefined functions for the enumeration type. 3.Declare the function prototypes for both the predecessor and successor functions. Package Implementation 1.Successor function: a.if the input_value = Type’Last thenreturn Type’Firstb.elsereturn Type’Succ(input_value);2.Predecessor function: a.if the input_value = Type’First thenreturn Type’Lastb.elsereturn Type’Pred(input_value);Code Listing GNAT 3.13p (20000509) Copyright 1992-2000 Free Software Foundation, Inc. Checking: c:/docume~2/jk/desktop/16070/codeso~1/my_type_package.ads (source file time stamp: 2003-09-24 01:59:20) 1. -----------------------------------------------------------2. -- Package specified to declare the type and two functions 3. -- Specifier : Jayakanth Srinivasan 4. -- Date Last Modified : 09/23/2003 5. -----------------------------------------------------------6....
View Full Document

This note was uploaded on 01/28/2012 for the course AERO 16.01 taught by Professor Markdrela during the Fall '05 term at MIT.

Page1 / 3

c09_ps04_sol - C9-1 Algorithm Package Specification...

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

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